and this what is a better way too write this without getting an error

if ((symb1 != 'A', 'a') || (symb2 != 'B', 'b') || (symb3 != 'C', 'c') || (symb4 != 'D', 'd'));; << endl;

{
cout << "Please enter an corresponding letter." << endl;
}

and this what is a better way too write this without getting an error

while ((symb1 != 'A', 'a') || (symb2 != 'B', 'b') || (symb3 != 'C', 'c') || (symb4 != 'D', 'd'));; >> endl;

{
cout << "Wrong" << endl;
<< "Enter one of the four letters.\n" ;
cin >> symb1 >> symb2 >> symb3 >> symb4;
}
else
cout << "You have chosen" << symb << endl;

and this is my program and i cant run it without errors, its 4 school so could u give me advise so i will know in the future

#include<iostream>
#include<string>
using namespace std;
int main()
{
char symb1, symb2, symb3, symb4;
int item_purch, numb_item_purch, quit;
double mug, tee_shirt, pen,tot_mon, curr_cash, mon_spent;

cout << "So what do you want to purchase today?\n";
symb1=('A','a');
symb2=('B','b');
symb3=('C','c');
symb4=('D','d');
cout << symb1 << " Mug" << mug << endl;
cout << symb2 << " Tee Shirt " << tee_shirt << endl;
cout << symb3 << " Pen " << pen << endl;
cout << symb4 << " Quit " << quit << endl;
mug = 2.50;
tee_shirt = 9.50;
pen = .75;
if ((symb1 != 'A', 'a') || (symb2 != 'B', 'b') || (symb3 != 'C', 'c') || (symb4 != 'D', 'd'));; << endl;

{
cout << "Please enter an corresponding letter." << endl;
}
else
cout << "You have chosen" << symb << endl;

cin >> symb1;
cin >> symb2;
cin >> symb3;
cin >> symb4;
cout << "You have a total of 30 dollars.\n";
cin >> tot_mon;
tot_mon = 30;
cout << "Please pick a letter that corresponds with the merchandice of your choosing.\n";\

while ((symb1 != 'A', 'a') || (symb2 != 'B', 'b') || (symb3 != 'C', 'c') || (symb4 != 'D', 'd'));; >> endl;

{
cout << "Wrong" << endl;
<< "Enter one of the four letters.\n" ;
cin >> symb1 >> symb2 >> symb3 >> symb4;
}
}

return 0;
}

Recommended Answers

All 3 Replies

If you have a question about a specific error, post the error message. If you want to post code, use code tags.

>what is a better way too write this without getting an error
Well, seeing as how your syntax is horribly broken, I'd say start by cracking a book on C++.

i did i cant figure it out im new at this

>i did i cant figure it out im new at this
Then you're trying to do too much, too fast. Start smaller.

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.