How to write a simple C ++ program, for example, in the form of a scoreboard, in which you can pass parameters without restarting it?
|
1 answer
For, as you said "scoreboard" you need to write an interface. Here is a simple example of working with the console:
#include <stdio.h> int main() { int c; while (1) { printf("* * * Enter the command, and click \"enter\": * * *\n\n'm': for send message 'm'\n'n': for send message 'n'\n'x': for exit\n"); c = getchar(); switch (c) { case 'm': printf("m: message m!\n"); c = getchar(); break; case 'n': printf("n: message n!\n"); c = getchar(); break; case 'x': printf("x: exit success!\n"); return 0; } } return 0; } |
argv[]in main), then with some restrictions you can use gdb - avp