0
What is the problem in this simple code?
#include <iostream> using namespace std; int main() { int a,b,c; cout << "Please Enter Your Name =" << endl; cin >> a; cout << "Please Enter Your Gender (M/F)=" << endl; cin >> b; cout << "Please Enter Your Age =" << endl; cin >> c; cout << "Your Name is "a << endl; cout << "Your Gender is "b << endl; cout << "Your Age is " c << endl; return 0; }
3 Answers
+ 4
The data type for name and gender is incorrect, you can't put a name (which is a string) into a (an int), same case you can't put gender (a char, one letter string) into b (an int). Use proper data type for the variables, it will fix your problem.
Hth, cmiiw
0
You use int type for words (int for 1,2,3,4...)
Or give what the program prints you when you run it, I'm lazy to copy this code and run it :D
0
^^^
This guy said a good thing