Own command prompt

Hello, I need a help. A want to create method to print the text. Also, i want to create new simple command say(); to print the text. How can i do that please?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
int main()
{

	string command;
        string textToPrint;
	main:
	
	std::cout <<"> ";
	std::cin >> command;
	
		if(command=="say("+textToPrint+");") {
			std::cout<< textToPrint << endl;	
	}

	system("echo.");
	goto main;
	return 0;
	
}
Last edited on
int main()

instead you should use:
int main(int argc, char* argv[])
and filter input...

and the:
goto main;
this is not how goto works, you need labels such as:

1
2
3
blah:
int x = 0;
goto blah;


instead of system("echo") use std::cout
Instead of cin >> command, you should include string and use getline(cin, command)

To check the command, you should just check to see if it has say. Your if will almost never pass if you check it the way you do.
Topic archived. No new replies allowed.