Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax trouble with C++ [closed]

Tags:

c++

syntax

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?

like image 632
GinKin Avatar asked Mar 26 '26 08:03

GinKin


1 Answers

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.

like image 88
Mike Seymour Avatar answered Mar 27 '26 21:03

Mike Seymour



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!