Hey, I just started on C++ beginner excercises and this error is making me want to puill my hair out..
Here's the code:
Code:
#include<iostream>
using namespace std;
int main()
{
int choice;
int run;
while(run!= 1){
cout << "Soda Selections" << endl;
cout << "---------------" << endl;
cout << "Coca Cola[1]" << endl;
cout << "Diet Coca Cola[2]" << endl;
cout << "Sprite[3]" << endl;
cout << "Sprite Zero[4]" << endl;
cout << "Dasani[5]" << endl;
cout << "Quit[6]" << endl;
cout << "**Use the numbers to choose your soda!**"<< endl;
cin >> choice;
switch(choice)
{
case 1:
cout << "You've chosen Coca Cola!" << endl;
break;
case 2:
cout << "You've chosen Diet Coca Cola!" << endl;
break;
case 3:
cout << "You've chosen Sprite!" << endl;
break;
case 4:
cout << "You've chosen Zero Sprite!" << endl;
break;
case 5:
cout << "You've chosen Dasani!" << endl;
break;
case 6:
return 0;
default:
cout << " Please make another selection.";
}
}
system("PAUSE");
}
I keep getting this:
Run-Time Check Failure #3 - The variable 'choice' is being used without being initialized.
Help Please?