Hi Hazukiy & welcome to cplusplus forums,
There are someof immediate small problems:
Is missing the # at the start ( It's not the same as the other #includes);
and
|
string list[MAXRESPONCES] = {"
|
is a syntax error because of the missing brace and missing double quote. This is also a problem because you haven't initialised the array - which is very important and the cause of a lot problems. BTW MAXRESPONCES is spelt MAXRESPON
SES
I seem to be telling nearly everyone not to do this:
It is is only a matter of style and a technical point, but it makes things easier for the compiler / optimiser because it does not bring in heaps of other stuff that isn't used. People do it all the time because they see it in text books. If you are using cin and cout and string then do this:
1 2 3
|
using std::cin;
using std::cout;
using std::string ;
|
You could also initialise name like this, and describe what it is for:
|
string name = ""; // the other persons name
|
There is no need to have the variable cpuname because you have defined it with #define, however the convention is name it with capital letters like this
1 2
|
#define CPUNAME
"James" //Defines the cpu name to respond to. Change it if you wish.
|
Be aware that all this does is replace all occurrences of CPUNAME
with "James".
Now having said all that, you should get used to using the debugger in your IDE, put cout statements everywhere to see what is happeneing to your variables.
Other important things are the naming of variables to something meaningful. Don't worry I seem to be telling everyone in the beginners forum about this also!
Could list[MAXRESPONCES] be ResponseList[MAXRESPONSES ] ? You need to put values into this array, (in the definition of the array is the easiest)
Next you need a for loop to cycle through the array using cout statements to present a "menu" to the user.
Then use a cin to store a response from the user.
Then a switch statement to carry out an action for a particular response.
Hope this helps.
Cheers TheIdeasMan