Hello..
i'm working on my project.. it's the first time i do a C++ project..
but i'm getting this fatal error..
if any one knows how to solve it plz tell me..
also if anyone have any idea or advice to improve the program plz go ahead.

#include <iostream> 
using namespace std;
int main ()
{

	int faq_choice,faq_YN;
		
		cout << "\t\t\t =================    "<<endl;
		cout << "\t\t\t     ||   || || ||    "<<endl;
		cout << "\t\t\t     ||   || || ||    "<<endl;
		cout << "\t\t\t     ||      || ||    "<<endl;
		cout << "\t\t\t \\   ||         ||   "<<endl;
		cout << "\t\t\t  \\  ||              "<<endl;
		cout << "\t\t\t   \\ ||              "<<endl;
		cout << "\t\t\t    \\||  J-Otaku-Air "<<endl;
		cout <<endl;
		cout <<endl;

do
{

	cout << "Welcome to the Frequently Asked Questions (FAQ) area."<<endl;
	cout << "Bellow is a list of frequently asked questions."<<endl;
	cout << "Choose the number of the required quest then press Enter to show the answer."<<endl;
	cout <<endl;
	cout <<endl;

	cout << "Q1. Should I reconfirm my flights, hotel or car reservations?"<<endl;
	cout << "Q2.What happens if the airline has changed my flights?"<<endl;
	cout << "Q3.Do you deliver tickets to other countries?"<<endl;
	cout << "Q4.Do you deliver tickets to a hotel/business or alternate place"<<endl;
	cout << "other than my home?"<<endl;
	cout << "Q5.What if my tickets are lost or stolen?"<<endl;

	
	cout <<endl;
	cin  >> faq_choice;
	cout <<endl;
	cout << "Are you sure you want question number "<<faq_choice << " ?(Y/N)"<<endl;
	cin  >> faq_YN;
	cout <<endl;
	cout <<endl;
	

	if ((faq_YN=='N') && (faq_YN=='n'))
	{
		cout << "If you are not happy with your choice, then please choose another question"<<endl;
	}

	if ((faq_YN=='Y') && (faq_YN=='y'))

	{
	
		cout<<"Here is the answer."<<endl;
	}
	
	
	switch (faq_YN)
	{
	case (1):
		cout << "Travelers are advised to contact the airline, hotel or car rental company"<<endl;
		cout << "at least 72 hours prior to departure."<<endl; 
	break;


	case (2):
		cout << "If the airline changed or cancelled your flights, the airline must assist you."<<endl;
		cout << "J-Otaku Air did not change the flights. The airline did,"<<endl; 
		cout << "thus the airline must fix your itinerary and/or ongoing travel."<<endl;
	break;

	case (3):
		cout << "Yes, we deliver tickets to other countries."<<endl;
		cout << "Delivery is via electronic ticketing for claiming at the airport ticket counter,"<<endl;
		cout << "or paper ticket via courier. Our booking engine will advise you as to the form "<<endl;
		cout << "of delivery for the flights that you have chosen."<<endl;
	break;


	case (4):
		cout << "Yes, we deliver tickets to your hotel/business or office or any alternate address"<<endl;
		cout << "where a courier may get signature for delivery of the package. "<<endl;
		cout << "Postal office boxes (PO Boxes) are not allowed. "<<endl;
	break;

	case (5):
		cout << "If your paper airline tickets are lost or stolen, please contact us or call us immediately."<<endl;
		cout << "If your original tickets are not used after a designated period of time-generally 3 to 4 months,"<<endl;
		cout << "you will receive credit for the purchase price of the original lost ticket."<<endl;
	break;

	default :
		cout << "Error! That was an invalid entry."<<endl;


	}
	while(faq_choice!=0);
return 0;
}

and this is the compiler's message:
1>------ Build started: Project: leish, Configuration: Debug Win32 ------
1>Compiling...
1>WHYYme.cpp
1>c:\users\fofa\documents\visual studio 2005\projects\leish\whyyme.cpp(103) : fatal error C1075: end of file found before the left brace '{' at 'c:\users\fofa\documents\visual studio 2005\projects\leish\whyyme.cpp(6)' was matched
1>Build log was saved at "file://c:\Users\fofa\Documents\Visual Studio 2005\Projects\leish\Debug\BuildLog.htm"
1>leish - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


plz help!

Recommended Answers

All 4 Replies

Its a braces problem check for unclosed braces in all of your program.

There is a missing brace in line of

while(faq_choice !=0)

just add '}' before this line.

it is for do while loop.

ok i did that.. the error was gone.. but i got an infinite loop !!
even though i'm getting 1 succeeded!

you got several errors in your code .

1- in int faq_choice,faq_YN;
y did u make faq_YN integer it have to be char that is why the infinite loop occurs.

2- in your if statements u made && it should be || cuz when making && the resulting of the if statement will always be false and wont enter body of the if statement.

3-in the switch statement y did u put faq_YN as its condition
it should be faq_choice .

4-there are other errors but sorry i have no time to state it but it wont make A difference in the program ,hope u find them by yourself.

hope that my corrections are right.

commented: Yes, totally right ! +7

Take a look at the corrected code and at Ahmed_I's post :)

#include <iostream> 
using namespace std;
int main ()
{

	int faq_choice;
	[B]char faq_YN;[/B]
		
	cout << "\t\t\t =================    "<<endl;
	cout << "\t\t\t     ||   || || ||    "<<endl;
	cout << "\t\t\t     ||   || || ||    "<<endl;
	cout << "\t\t\t     ||      || ||    "<<endl;
	cout << "\t\t\t \\   ||         ||   "<<endl;
	cout << "\t\t\t  \\  ||              "<<endl;
	cout << "\t\t\t   \\ ||              "<<endl;
	cout << "\t\t\t    \\||  J-Otaku-Air "<<endl;
	cout <<endl;
	cout <<endl;

       do
       {

	    cout << "Welcome to the Frequently Asked Questions (FAQ) area."<<endl;
	    cout << "Bellow is a list of frequently asked questions."<<endl;
	    cout << "Choose the number of the required quest then press Enter to show the answer."<<endl;
	    cout <<endl;
            cout <<endl;

	    cout << "Q1. Should I reconfirm my flights, hotel or car reservations?"<<endl;
	    cout << "Q2.What happens if the airline has changed my flights?"<<endl;
	    cout << "Q3.Do you deliver tickets to other countries?"<<endl;
	    cout << "Q4.Do you deliver tickets to a hotel/business or alternate place"<<endl;
	    cout << "other than my home?"<<endl;
	    cout << "Q5.What if my tickets are lost or stolen?"<<endl;

	
            cout <<endl;
	    cin  >> faq_choice;
	    cout <<endl;
	    cout << "Are you sure you want question number "<<faq_choice << " ?(Y/N)"<<endl;
	    cin  >> faq_YN;
	    cout <<endl;
	    cout <<endl;
	

            if ((faq_YN=='N') [B]||[/B] (faq_YN=='n'))
	    {
               cout << "If you are not happy with your choice, then please choose another question"<<endl;
	    }

	    if ((faq_YN=='Y') [B]||[/B] (faq_YN=='y'))
	    {
	
		cout<<"Here is the answer."<<endl;
	    }
	
	
	    switch ([B]faq_choice[/B])
	    {
	    case (1):
		cout << "Travelers are advised to contact the airline, hotel or car rental company"<<endl;
		cout << "at least 72 hours prior to departure."<<endl; 
	        break;

	    case (2):
		cout << "If the airline changed or cancelled your flights, the airline must assist you."<<endl;
		cout << "J-Otaku Air did not change the flights. The airline did,"<<endl; 
		cout << "thus the airline must fix your itinerary and/or ongoing travel."<<endl;
	        break;

	    case (3):
		cout << "Yes, we deliver tickets to other countries."<<endl;
		cout << "Delivery is via electronic ticketing for claiming at the airport ticket counter,"<<endl;
		cout << "or paper ticket via courier. Our booking engine will advise you as to the form "<<endl;
		cout << "of delivery for the flights that you have chosen."<<endl;
                break;

	    case (4):
		cout << "Yes, we deliver tickets to your hotel/business or office or any alternate address"<<endl;
		cout << "where a courier may get signature for delivery of the package. "<<endl;
		cout << "Postal office boxes (PO Boxes) are not allowed. "<<endl;
                break;

 	     case (5):
		cout << "If your paper airline tickets are lost or stolen, please contact us or call us immediately."<<endl;
		cout << "If your original tickets are not used after a designated period of time-generally 3 to 4 months,"<<endl;
		cout << "you will receive credit for the purchase price of the original lost ticket."<<endl;
	        break;

	      default :
		cout << "Error! That was an invalid entry."<<endl;

	      }
    [B]}[/B] while(faq_choice!=0);
    return 0;
}
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.