I have a problem in the following c++ program,while getting a input '08' and '09' it skip the next immediate input value. Why it is happening if you know the reason please send to me..
1 2 3 4 5 6 7 8 9 10 11 12 13
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
cout<<"Enter the value for a"<<endl;
cin>>a;
cout<<"Enter the Value for b"<<endl;
cin>>b;
cout<<"Enter the value for c"<<endl;
cin>>c;
getch();
}
Sample Input(with problem)
Enter the value for a
08
Enter the Value for b
Enter the value for c
Sample Input(without problem)
Enter the value for a
03
Enter the Value for b
05
Enter the value for c
07
#include <iostream> // modern headers do not have .h extension
// conio.h is not standard
int main() // void main() is not standard
{
int a, b, c;
// C++ uses the std:: namespace
std::cout << "Enter the value for a" << std::endl;
std::cin >> a;
std::cout << "Enter the Value for b" << std::endl;
std::cin >> b;
std::cout << "Enter the value for c" << std::endl;
std::cin >> c;
// getch() is not standard
}
The program above compiles fine in Visual Studio 2010 Express and has no input errors.
Catfish2 , While using a visual c++ i can use iostream header file (instead of iostream.h) and name space std. But i can't use it in Turbo c++. Now that is not a matter, I like to know the reason for above mentioned problem.
Even Visual C++ Complier also produce the same problem when i using a iostream.h file.
Thanks Caligulaminus, In octal 10 and 11 also don't have a digit. but i am giving input like '010' ,'011', '012' etc. It gets a input without skipping.
But i am giving a input '018','019','028','029' same problem will exist.