### Expected Primary-Expression before "char"

Hello, all!

I'm currently writing a program for my C++ class... Unfortunately, I have run into an issue that I can't seem to solve. I'm sure it's an easy issue that I am just not seeing, so I thought I'd throw it up here. I'll continue to try to figure it out while waiting for a reply.

(I am using Dev-C++) When I try to compile it, it gives me:
line 15: expected primary-expression before "char"
line 15: expected ';' before "char"
line 23: expected primary-expression before "continue"
line 23: expected ')' before "continue"
line 23: expected ';' before '==' token
line 23: expected primary-expression before "continue" (yes, it gave this one twice)
line 23: expected ';' before "continue"

Anyway, here it is:

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455`` ``````/////////////////////////////////////////////////////////// //Description: A program to calculate the speed of sound. //Accept user input of two air tempuratures, then display //the velocity of sound at that air tempurature. // //Formula to find speed: // velocity = 331.3 + 0.61 * currentTemp //////////////////////////////////////////////////////////// #include using namespace std; int main() { char continue = 'y'; //do it again? int temp1; //starting tempurature int temp2; //ending tempurature int currentTemp; //current tempurature being calculated double velocity; //velocity of sound at given tempurature while (continue == 'y' || continue == 'Y') { cout << "Enter the starting tempurature, in Celsius (Must use whole numbers): "; cin >> temp1; cout << "\n\nEnter the ending tempurature, in Celsius (Must use whole numbers): "; cin >> temp2; system("cls"); if (temp1 < temp2) { for (currentTemp = temp1; currentTemp <= temp2; currentTemp++) { velocity = 331.3 + 0.61 * currentTemp; cout << "At " << currentTemp << " degrees Celsuis the velocity of sound is " << velocity << "\n"; } } else if (temp1 > temp2) { for (currentTemp = temp1; currentTemp >= temp2; currentTemp--) { velocity = 331.3 + 0.61 * currentTemp; cout << "At " << currentTemp << " degrees Celsuis the velocity of sound is " << velocity << "\n"; } } else { velocity = 331.3 + 0.61 * temp1; cout << "You entered the same value for both. Only one answer will be given.\n\nAt " << currentTemp << " degrees Celsuis the velocity of sound is " << velocity << "\n"; } cout << "\n\n\nWould you like to do this again? (y/n): "; cin >> continue; } system("pause"); return 0; }``````
Last edited on
'continue' is a reserved keyword.
Ah! Thank you for the quick reply... I need to print out a list of these reserved keywords, and at least familiarize myself with them.

Thanks again! That solved it :)
Topic archived. No new replies allowed.