473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Expected primary-expression before "else"

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <string>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <windows.h>
  6.  
  7. void goTo (int x, int y){
  8.          HANDLE hConsole= GetStdHandle(STD_OUTPUT_HANDLE);
  9.          COORD pos;
  10.          pos. X=x; 
  11.          pos. Y=y;
  12.  
  13.     SetConsoleCursorPosition(hConsole, pos);
  14. }
  15. using namespace std;
  16.  
  17. int main()
  18.  
  19.  
  20. {    
  21.  
  22.  
  23. int a, b, c, d, e;
  24. string choice;
  25.  
  26.  
  27.  
  28. cout << "Enter Your Choice: ";
  29. cin  >> choice;
  30. goTo(20, 10);
  31. cout << "=====================================";
  32. goTo (20, 13);
  33. cout << "=====================================";
  34. goTo(21, 11);
  35. cout << "[A]......Add New Record";
  36. goTo(21, 12);
  37. cout << "[b]......Search";
  38. goTo(21, 13);
  39. cout << "[C]......Edit";
  40. goTo(21, 14);
  41. cout << "[D]......Delete";
  42. goTo(21, 15);
  43. cout << "[E]......Exit";
  44. system("cls");
  45.  
  46. if (choice == "A")
  47. {
  48.  
  49.           goTo(21, 10);
  50.           cout << "=====================================";
  51.           goTo(22, 10);
  52.           cout << "=";
  53.           goTo(22, 37);
  54.           cout << "=";
  55.           goTo(23, 10);
  56.           cout << "=";
  57.           goTo(23, 37);
  58.           cout << "=";
  59.           goTo(24, 10);
  60.           cout << "=";
  61.           goTo(24, 37);
  62.           cout << "=";
  63.           goTo(25, 10);
  64.           cout << "=";
  65.           goTo(25, 37);
  66.           cout << "=";
  67.           goTo(26, 10);
  68.           cout << "=";
  69.           goTo(26, 37);
  70.           goTo(21, 11);
  71.           cout << "ADD NEW RECORD";
  72.          goTo(20, 10);
  73.                   cout << "=====================================";
  74.          goTo (20, 13);
  75.                    cout << "=====================================";
  76.           cout << "Name: \n";
  77.           cout << "Age: \n";
  78.           cout << "Address: \n";
  79.           cout << "Course: \n";
  80.           cout << "Year Level: ";
  81.           goTo(21, 13);
  82.           cout << "=====================================";
  83. }
  84.  
  85.     else if (choice == "B");
  86.      {
  87.      cout << "SEARCH";
  88.           goTo(20, 10);
  89.                   cout << "=====================================";
  90.           goTo (20, 13);
  91.                   cout << "=====================================";
  92.  
  93.                   return 0;
  94.      }
  95.  
  96.  
  97.         else if (choice == "C")
  98.      {
  99.  
  100.      cout << "EDIT";
  101.           goTo(20, 10);
  102.                   cout << "=====================================";
  103.           goTo (20, 13);
  104.                   cout << "=====================================";
  105.  
  106.      }
  107.  
  108.                   else if (choice == "D")
  109.                   {
  110.                   cout << "Delete";
  111.                        goTo(20, 10);
  112.                                 cout << "=====================================";
  113.                        goTo (20, 13);
  114.                                 cout << "=====================================";
  115.                   }
  116.  
  117.                                 else if (choice == "E")
  118.                                 {
  119.                                 cout << "Thank You!";
  120.  
  121.                                 system("pause>null");
  122.                                 }
  123. return 0;
  124.  
  125.  
  126. }
  127.  
  128.  
Mar 18 '12 #1
1 2788
weaknessforcats
9,208 Expert Mod 8TB
The error is here:

Expand|Select|Wrap|Line Numbers
  1. else if (choice == "B");
  2.  {
The semi-colon terminates the if stateent. Remoe it.

All I did was compile ths code and look on the line the compiler said had an error.
Mar 18 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: andy.herrera | last post by:
I'm getting this Error Message. Expected ';' Please Select One: <form name="form1"> <<------------ Error is here. <select name="selectTrans" onChange="If (this.value == 'checkout')...
3
by: Jon | last post by:
I'm learning about datatables. When using the example provided by MS in the ..NET Framework Class Library for DATATABLE (see below) I get an error on line 3 that says "Type expected". Is something...
7
by: Warrax | last post by:
I am currently doing online tutorials for C++, and am pretty much stuck in a rut about this problem. It is saying that there's an expected unqualifed-id before '{' token (I will post the code in just...
1
by: JOJO123 | last post by:
I got here in search of an answer to this Javascrpt question. I upgraded jave on XP Ie 7, acrobat 5.1 and suddenly can't open any pdf files on web sites using IE. I see u guys all say, this is a...
6
by: Lawrence Spector | last post by:
I ran into a problem using g++. Visual Studio 2005 never complained about this, but with g++ I ran into this error. I can't figure out if I've done something wrong or if this is a compiler bug. ...
5
by: amitmool | last post by:
hi, i have used the queue library file and try to use the template as template <class QueueItem> queue <QueueItem>::~queue() // line 25 { } template <class QueueItem> void...
1
by: Hunternora | last post by:
I'm just trying to count letters, by type etc. What am I doing wrong here? import javax.swing.JOptionPane; public class Asg3 { public static void main(String args) { int aCount=0,...
10
by: preeya | last post by:
Hi, I have written the following program: ------------------------------------------------------------------------------------------------------------- 1 #include <stdio.h> 2 #include...
9
by: erictheone | last post by:
Ok so what I'm trying to do is create a trans location cipher. For those among us that don't know alot about cryptography it is a method for jumbling up letters to disguise linguistic...
1
by: rameshjumgam | last post by:
i am having in my code like std::list<T*>::const_iterator iter=lst.begin(); and i am getting error error: expected `;' before âiterâ /root/INCLUDE/cw/gdlist.h:140: error: âiterâ was...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.