Hi
Below is a script that im making. Its going to be a simple phone directory. You Enter A Name and it will give you that persons phone number..
Neways..I was wondering how you would impliment a Press Q To Quit in there. Ive tried the if(name == 'q') but it doesnt compile nicely
Cheers For The Help
Alex
Code:#include <iostream>
#include <cstdio>
using namespace std;
int main () {
int i;
char name[80];
char numbers[10] [80] = {
"Alex", "4783748738378",
"Anita", "334455235342",
"Martin", "015223354666"
};
cout << "\nPLEASE ENTER THE NAME (q To Quit): ";
cin >> name;
for(i=0; i <= 10; i =+ 2)
if(!strcmp(name, numbers[i])) {
cout << "The Number Is: " << numbers[i+1] << "\n";
}
return 0;
}