Hello guys,
This code returns 2 errors and I dont understand why.

#include <iostream>
#include <string>
using namespace std;

char choice;
void M();
void C();
void Process();

void M(){
	cout <<"Multiplication\n";
}
void C(){
	cout << "Calculation\n";
}
void Process(){
	cout << "Make a choice\n"
		<< "C or M only\n";
	cin >> choice;
	while (strcmp(choice, "M")!=0) || (strcmp(choice, "C")!=0){
		cout << "ERROR Enter again";
	cin >> choice;
	
	}
	return;
}


void main () {
	Process();
	while (strcmp(choice, "M") == 0){
		M();
	}
	return;
	while (strcmp(choice, "C") == 0){
		C();
		return ;
	}
	
}

Any idea? thanks

Recommended Answers

All 5 Replies

Oh... I got it. I'm using strcmp to compare a char variable. :)

Good, well next time try doing the checking first Ok

Hello my poor c++ programmers
strcmp take two argument of type char * i.e array of character not char
i.e you can compare between
char *p = "SADDAM",l= "BOOSH";
cout << strcmp(p,l);
i hope you understand this thing

Hello my poor c++ programmers
strcmp take two argument of type char * i.e array of character not char
i.e you can compare between
char *p = "SADDAM",l= "BOOSH";
cout << strcmp(p,l);
i hope you understand this thing

What makes you so rich abu_sager?
:!:

Abu & FireNet,

Let's keep the discussion Technical, and leave the other stuff off the boards please. That is what we are here for. Let's choose our wording better next time.

Christian

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.