I'm trying to take several letters as input and then print them in a ceratin order, here's an example:
#include<iostream>
using namespace std;
void main()
{
char aaa, bbb, ccc;
cout << "input 3 letters ";
cin >> aaa >> bbb >> ccc;
cout << aaa " " << bbb " " << ccc endl;
}
I'm trying to make a space between each variable but it doesn't work.
This doesn't work either:
cout << aaa <<" " << bbb <<" " << ccc endl;
PS: is not ok to ask questions about problems with syntax?
Put << between everything in the cout expression. You're still missing one before endl.
cout << aaa <<" " << bbb <<" " << ccc << endl;
^^
PS: is not ok to ask questions about problems with syntax?
Yes, it's fine. But if the answer is that it's a simple error, the question will probably be closed since it won't be helpful to others.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With