ok.. I made this work ok.. but now I have the problem, I cant enter one word without 2 spaces.. like "exit" or "quit" "stat" etc.. my code is now:
Code:
#include <iostream.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
char first[10], second[10];
void wear()
{
if (!strcmp(second, "shirt")) {cout << "\nYou wear the ragget old shirt";}
else if (!strcmp(second, "pants")) {cout << "\nYou wear the pants";}
else if (!strcmp(second, "caps")) {cout << "\nYou wear the red caps";}
else if (!strcmp(second, "boots")) {cout << "\nYou wear the smooth, black boots";}
else {cout << "\nYou dont have that to wear!";}
}
void get()
{
if (!strcmp(second, "shirt")) {cout << "\nYou get a ragget old shirt";}
else if (!strcmp(second, "pants")) {cout << "\nYou get tha pants";}
else if (!strcmp(second, "caps")) {cout << "\nYou get the red caps";}
else if (!strcmp(second, "boots")) {cout << "\nYou get a pair of smooth, black boots.";}
else {cout << "\nYou cant see that item anywhere";}
}
int main(void)
{
while(1)
{
cout << "\nYour command? ";
cin.getline(first,10, ' '); textbackground
cin.getline(second,10, '\n');
if (!strcmp(first, "wear")) {wear();}
else if (!strcmp(first, "get")) {get();}
else if (!strcmp(first, "exit")) {exit(1);}
else {cout << "\n What? Who? When!?";}
}
}