+ 4
Why isn't this code working ?
Constructive criticism is accepted. This code isn't working does anyone have an explanation. I ran the code in Code::Blocks #include <iostream> using namespace std; void crappyPrint() { signed int x; cin >> "What is your name ? " >> x >> endl; } int main() { cout << "Your name is "; crappyPrint(); return 0; } If you want the build log, Just ask :)
6 Answers
+ 15
cin is solely used for console input, and has to be followed by a variable. You should do it this way:
cout << "What is your name?" << endl;
cin >> x;
// P.S. Burn Code::Blocks.
+ 5
@Hasty Rei i love code::block == đlol
+ 2
@Hasty Rei thank you anyway
+ 1
@Hasty Rei I thought so but I saw something like that somewhere else(Eclipse)
+ 1
Don't forget to use char array or string for Name variable
0
:0 it should be char x[ ], you cannot take alphabets in a numerical variable...and you have to take an array as well...