i ran the following code in the latest version of code::blocks and it tells me that the objects cout and cin are not declared in this scope. what is the problem?
I used to use Turbo C++ 3.0 and i had no problem whatsoever with that compiler. But now i am trying to move to code::blocks but it is proving very very hard as all the standards have been changed.
I am a school student and thus, we had been told to practice on Turbo C++ 3.0 and now i am unable to unlearn it. Also, if i use printf in place of cout there is no error but i want to use cout as it is what i am comfortable working with.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include<fstream>
#include<conio.h>
int main()
{
usingnamespace std;
char name[20];
cout<<"\nEnter your name:";
cin.getline(name,20);
cout<<"\nName has been stored";
getch();
return 0;
}
Please help me with this issue. Is there some document to which i can refer so as to get the latest C++ standards which is C++0x i believe?
common, fstream has everything from iostream. I changed the code anyway and the following code says that: clrscr() is not declared in this scope. What is the problem. WHy cant they just keep it simple?!
Interesting... how can you be so sure " fstream has everything from iostream", if you just simply search for these two libraries, they are totally different, I wonder if fstream would provide cout / cin functions.
For the clrscr() problem, this function is not part of the C++ standard.
clrscr was available in the ancient Turbo C++.
@andywestken
(There is no general C++ way to solve the problem; if you need the functionality you'll require either platform specific solution or a console library (e.g. CURSES).
The Windows console API is not the friendliest API, but Microsoft Support do provide a code snippet:
How To Performing Clear Screen (CLS) in a Console Application http://support.microsoft.com/kb/99261))
are you telling me that the fucntions have been changed?
is that why everyone is so inclined on using
1 2 3
system("cls")
so, all of you guys are saying that i would have to unlearn everything i have learned for Turbo C++ till now and learn all the header and library functions et al again all over from the beginning?!