Im learning to use strings and I made a code using them, but im getting errors at lines 8, 9 and 10
Line 8: no match for call to '(std::string {aka std::basic_string<char>}) (const char [5])'|
Line 8: expected '}' before ';' token|
Line 9:'run' does not name a type|
Line 10: expected unqualified-id before 'while'|
What im doing wrong?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include<iostream>
usingnamespace std;
string commands;
int run;
int main {
commands ("none");
run = 1;
while (run == 1) {
cout << "Enter a command";
cin >> commands;
if (commands == "ping") {
cout << "pong";
commands ("none");
}
}
}