1 Replies - 161 Views - Last Post: 05 February 2019 - 06:36 AM Rate Topic: -----

#1 nTensity01   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 02-February 19

DO WHILE LOOP -- HELP!

Posted 05 February 2019 - 06:33 AM

Why can't the program run? It Keeps saying...
6 1 C:\Users\Shop01\Desktop\100.cpp [Error] expected unqualified-id before '{' token
TY in advance :)/>
#include<iostream>
using namespace std;

int main();

{
	int counter= 4, x=1;
	string InputWord;
	
	do{
		cout << "Enter Your Guess(InputWord): "<< endl;
		cout << "Sample: "<< endl;
		cin >> InputWord;
			if((InputWord.compare("CS100A")==0)||(InputWord.compare("CEA")==0)||(InputWord.compare("Engineering")==0)||(Input.comapare("T.I.P")==0)||(InputWord.comapare("Quezon City")==0)||(InputWord.compare("Philippines"));
			{
				counter ==-1;
				cout << "Congrats,You Got It Right..."<< endl;
				cout << "Sample"<< x++ << Is A Magic Word << endl;
				break;
				}	
			else
			{
				cout << "Sample"<< x++ <<"Is Not A Magic Word"<< endl;
				cout << "You Have "<< counter -- << "Trial/s Left."<< endl;
				cout << "Please Enter To Continue... "<< endl;
				cout << endl;
				system("pause");
				system("cls");
				if(counter==-1)
				{
					cout << "Sample 5 Is Not A Magic Word"<< endl;
					cout << "No Available Number Of Attempts Left..."<< endl;
					cout << "Program Terminated..."<< endl;
				}
			}
	}
}
:code:

This post has been edited by modi123_1: 05 February 2019 - 07:45 AM
Reason for edit:: In the future, please use the [code] tag button in the editor.


Is This A Good Question/Topic? 0
  • +

Replies To: DO WHILE LOOP -- HELP!

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14854
  • View blog
  • Posts: 59,270
  • Joined: 12-June 08

Re: DO WHILE LOOP -- HELP!

Posted 05 February 2019 - 06:36 AM

You dont put semicolons right after if conditions.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1