I have written a simple programme but it is not compiling, give these errors
1."cout undeclared first use this function"
2."cin undeclared first use this function"
#include <iosream>
main()
{
//this programme is desighn to seprate the digits of 4 digit number.
int number;
int digit;
//prompt to user to enter the number
cout << "Please enter 4 digit number:";
cin >> number;
digit = number%10;
cout << "The digit is:" << digit << "\n";
number=number/10;
digit=number%10;
cout<<"The digit is:"<<digit<<"\n";
number=number/10;
digit=number%10;
cout<<"The digit is:"<<digit<<"\n";
number=number/10;
digit=number%10;
cout<<"The digit is:"<<digit<<"\n";
}
For clarification, pretty much everything in the C++ standard library is in the std namespace, cout and endl included.
And your definition of main is invalid. You forgot to add the return type (int).
thanks for reply now it gives error
1."cout is not a member of std"
2."cin is not a member of std "
#include <iostream>
int main()
{
//this programme is desighn to seprate the digits of 4 digit number.
int number;
int digit;
//prompt to user to enter the number
std::cout << "Please enter 4 digit number:";
std::cin >> number;
digit = number%10;
std::cout << "The digit is:" << digit << "\n";
number=number/10;
digit=number%10;
std::cout<<"The digit is:"<<digit<<"\n";
number=number/10;
digit=number%10;
std::cout<<"The digit is:"<<digit<<"\n";
number=number/10;
digit=number%10;
std::cout<<"The digit is:"<<digit<<"\n";
}
Yes, it is. DevC++ is not a good program to use. The whole thing is old and no longer maintained. How about you try Code::Blocks? http://www.codeblocks.org/
(Code::Blocks can be downloaded packaged with a reasonably up to date MinGW compiler.)
And just to avoid any confusion, DevC++ is not a compiler. It is an Integrated Development Environment (IDE). It combines an editor with a compiler toolset among other things. The actual compiler, which produces machine code from your source, is called MinGW (Minimalist GNU for Windows).
thanks a lot "Ather" , "L B" and "Xander314"
I am new at c++ first of all "Ather" detected the problem :)
now i m going to download other one for coding in c++.
thanks again