943,816 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 433
  • C++ RSS
May 31st, 2009
0

Help on fatal error :S!!

Expand Post »
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.

C++ Syntax (Toggle Plain Text)
  1.  
  2. #include <iostream>
  3. using namespace std;
  4. int main ()
  5. {
  6.  
  7. int faq_choice,faq_YN;
  8.  
  9. cout << "\t\t\t ================= "<<endl;
  10. cout << "\t\t\t || || || || "<<endl;
  11. cout << "\t\t\t || || || || "<<endl;
  12. cout << "\t\t\t || || || "<<endl;
  13. cout << "\t\t\t \\ || || "<<endl;
  14. cout << "\t\t\t \\ || "<<endl;
  15. cout << "\t\t\t \\ || "<<endl;
  16. cout << "\t\t\t \\|| J-Otaku-Air "<<endl;
  17. cout <<endl;
  18. cout <<endl;
  19.  
  20. do
  21. {
  22.  
  23. cout << "Welcome to the Frequently Asked Questions (FAQ) area."<<endl;
  24. cout << "Bellow is a list of frequently asked questions."<<endl;
  25. cout << "Choose the number of the required quest then press Enter to show the answer."<<endl;
  26. cout <<endl;
  27. cout <<endl;
  28.  
  29. cout << "Q1. Should I reconfirm my flights, hotel or car reservations?"<<endl;
  30. cout << "Q2.What happens if the airline has changed my flights?"<<endl;
  31. cout << "Q3.Do you deliver tickets to other countries?"<<endl;
  32. cout << "Q4.Do you deliver tickets to a hotel/business or alternate place"<<endl;
  33. cout << "other than my home?"<<endl;
  34. cout << "Q5.What if my tickets are lost or stolen?"<<endl;
  35.  
  36.  
  37. cout <<endl;
  38. cin >> faq_choice;
  39. cout <<endl;
  40. cout << "Are you sure you want question number "<<faq_choice << " ?(Y/N)"<<endl;
  41. cin >> faq_YN;
  42. cout <<endl;
  43. cout <<endl;
  44.  
  45.  
  46. if ((faq_YN=='N') && (faq_YN=='n'))
  47. {
  48. cout << "If you are not happy with your choice, then please choose another question"<<endl;
  49. }
  50.  
  51. if ((faq_YN=='Y') && (faq_YN=='y'))
  52.  
  53. {
  54.  
  55. cout<<"Here is the answer."<<endl;
  56. }
  57.  
  58.  
  59. switch (faq_YN)
  60. {
  61. case (1):
  62. cout << "Travelers are advised to contact the airline, hotel or car rental company"<<endl;
  63. cout << "at least 72 hours prior to departure."<<endl;
  64. break;
  65.  
  66.  
  67. case (2):
  68. cout << "If the airline changed or cancelled your flights, the airline must assist you."<<endl;
  69. cout << "J-Otaku Air did not change the flights. The airline did,"<<endl;
  70. cout << "thus the airline must fix your itinerary and/or ongoing travel."<<endl;
  71. break;
  72.  
  73. case (3):
  74. cout << "Yes, we deliver tickets to other countries."<<endl;
  75. cout << "Delivery is via electronic ticketing for claiming at the airport ticket counter,"<<endl;
  76. cout << "or paper ticket via courier. Our booking engine will advise you as to the form "<<endl;
  77. cout << "of delivery for the flights that you have chosen."<<endl;
  78. break;
  79.  
  80.  
  81. case (4):
  82. cout << "Yes, we deliver tickets to your hotel/business or office or any alternate address"<<endl;
  83. cout << "where a courier may get signature for delivery of the package. "<<endl;
  84. cout << "Postal office boxes (PO Boxes) are not allowed. "<<endl;
  85. break;
  86.  
  87. case (5):
  88. cout << "If your paper airline tickets are lost or stolen, please contact us or call us immediately."<<endl;
  89. cout << "If your original tickets are not used after a designated period of time-generally 3 to 4 months,"<<endl;
  90. cout << "you will receive credit for the purchase price of the original lost ticket."<<endl;
  91. break;
  92.  
  93. default :
  94. cout << "Error! That was an invalid entry."<<endl;
  95.  
  96.  
  97. }
  98. while(faq_choice!=0);
  99. return 0;
  100. }

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!
Similar Threads
Reputation Points: 7
Solved Threads: 0
Junior Poster in Training
fadia is offline Offline
89 posts
since Apr 2009
May 31st, 2009
0

Re: Help on fatal error :S!!

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

There is a missing brace in line of
Quote ...
while(faq_choice !=0)
just add '}' before this line.

it is for do while loop.
Last edited by Ahmed_I; May 31st, 2009 at 3:26 pm.
Reputation Points: 14
Solved Threads: 1
Light Poster
Ahmed_I is offline Offline
32 posts
since Nov 2008
May 31st, 2009
0

Re: Help on fatal error :S!!

ok i did that.. the error was gone.. but i got an infinite loop !!
even though i'm getting 1 succeeded!
Reputation Points: 7
Solved Threads: 0
Junior Poster in Training
fadia is offline Offline
89 posts
since Apr 2009
May 31st, 2009
1

Re: Help on fatal error :S!!

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.
Last edited by Ahmed_I; May 31st, 2009 at 4:10 pm.
Reputation Points: 14
Solved Threads: 1
Light Poster
Ahmed_I is offline Offline
32 posts
since Nov 2008
May 31st, 2009
0

Re: Help on fatal error :S!!

Take a look at the corrected code and at Ahmed_I's post
#include <iostream> 
using namespace std;
int main ()
{

	int faq_choice;
	char 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_choice)
	    {
	    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;
}
Last edited by tux4life; May 31st, 2009 at 5:26 pm.
Reputation Points: 2125
Solved Threads: 243
Postaholic
tux4life is offline Offline
2,105 posts
since Feb 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: sudoku c++ help :D
Next Thread in C++ Forum Timeline: the "while (condition) wont work.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC