![]() |
|
#1
|
|||
|
|||
Fraction programI wrote this to perform arithmetic and relational operations on fractions but getting a few errors and was hoping someone could clue me in.
fraction.h CPP / C++ / C Code:
fraction.cpp CPP / C++ / C Code:
fractionmain.cpp CPP / C++ / C Code:
Errors: fractionmain.cpp error C2065: 'cout' : undeclared identifier error C2065: 'endl' : undeclared identifier error C2065: 'cin' : undeclared identifier error C3861: 'cout': identifier not found, even with argument-dependent lookup error C3861: 'endl': identifier not found, even with argument-dependent lookup error C3861: 'cin': identifier not found, even with argument-dependent lookup error C3861: 'cout': identifier not found, even with argument-dependent lookup error C3861: 'endl': identifier not found, even with argument-dependent lookup fraction.cpp error C2065: 'cout' : undeclared identifier error C2065: 'endl' : undeclared identifier error C3861: 'cout': identifier not found, even with argument-dependent lookup error C3861: 'cout': identifier not found, even with argument-dependent lookup error C3861: 'cout': identifier not found, even with argument-dependent lookup It's obvious that the errors are with cout, cin, and endl but what did I miss? Thanks Spuds |
|
#2
|
||||
|
||||
|
The identifiers cout, cin, and endl are all defined in the std namespace. To use them, either
a) insert the statement "using namespace std;" at the top of your cpp files, or b) use the identifiers std::cout, std::cin, and std::endl Matthew |
|
#3
|
|||
|
|||
|
Quote:
Worked like a champ, all my exercises have that statement. I just forgot about it, at least now I know what happens without it. Thanks |
|
#4
|
|||
|
|||
Re: Fraction programI also faced this problem error C2065: 'cout' : undeclared identifier and I TRIED WITH NAMESPACE But it did not work. The real problem was the #include <StdAfx.h> was not the first line of my .cpp file. Do remember anything before this header is not compiled and hance #include<iostream.h> was not getting compiled. |
|
#5
|
||||
|
||||
Re: Fraction programQuote:
CPP / C++ / C Code:
__________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
|
#6
|
|||
|
|||
Re: Fraction programso what should I do. if I am havind
#include "StdAfx.h" and I need to port the program |
|
#7
|
||||
|
||||
Re: Fraction programQuote:
Quote:
__________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
Recent GIDBlog
Toyota - 2008 November Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [TUTORIAL] Calling an external program in C (Linux) | dsmith | C Programming Language | 4 | 22-Apr-2005 14:30 |
| Adding icon to my program? | leitz | C++ Forum | 0 | 15-Nov-2004 13:47 |
| fltk-2.0 cvs | Plumb | FLTK Forum | 20 | 13-Nov-2004 08:10 |
| Anyone can write a program code for this??? | chriskan76 | C Programming Language | 1 | 19-Oct-2004 21:25 |
| Need help with a C program (Long) | McFury | C Programming Language | 3 | 29-Apr-2004 21:06 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The