New to programming, haven't seen this error before

This is a discussion on New to programming, haven't seen this error before within the C++ Programming forums, part of the General Programming Boards category; I am beginning to write a program and before I continue writing it I want to get this resolved to ...

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    15

    New to programming, haven't seen this error before

    I am beginning to write a program and before I continue writing it I want to get this resolved to make sure that my menu works. I am getting the error
    Code:
    "error: expected unqualified-id before '{' token"
    for lines 71, 78, 85, and 92 (the opening brackets for 4 of the void function definitions). I did a google search but came up with nothing that resolved the issue so here I am. Any help would be much appreciated, and if you could post a modified version of my code that would really help me to understand what you say.


    Code:
    //*********************************************************************************//*
    //*
    //*
    //*
    //*
    //*********************************************************************************
    
    
    
    
    #include <iostream>
    #include <fstream>
    #include <cstdlib>
    using namespace std;
    
    
    void menu_options (int& ch);
    
    
    void display_cat ();
    
    
    void search_for_cat ();
    
    
    void cat_most ();
    
    
    void cat_least ();
    
    
    int main()
    {
    
    
      int choice;
    
    
      cout.setf(ios::fixed);
      cout.setf(ios::showpoint);
      cout.precision(2);
    
    
      do {
        menu_options (choice);
        switch (choice)
        {
          case 1: display_cat ();
                  break;
          case 2: search_for_cat ();
                  break;
          case 3: cat_most ();
                  break;
          case 4: cat_least ();
                  break;
          case 5: cout << "Thank you for using my program\n\n";
                  break;
          default: cout << "Please enter a valid choice:\n";
        }
        } while (choice != 5);
    
    
    }
    
    
    void menu_options (int& ch)
    {
    
    
      cout << "1 - display total" << endl
    
    
      cout << "1 - display total" << endl
           << "2 - search for categories" << endl
           << "3 - category that cost the most" << endl
           << "4 - category that cost the least" << endl
           << "5 - exit" << endl << endl
           << "Enter your choice --> " << endl << endl;
    
    
      cin >> ch;
    
    
    }
    
    
    void display_cat ();
    {
    
    
      cout << "This is category 1 (one)";
    
    
    }
    
    
    void search_for_cat ();
    {
    
    
      cout << "This is category 2 (two)";
    
    
    }
    
    
    void cat_most ();
    {
    
    
      cout << "This is category 3 (three)";
    
    
    
    
    }
    
    
    void cat_least ();
    {
    
    
      cout << "This is category 4 (four)";
    
    
    }

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,652
    Code:
    cout << "1 - display total" << endl
    Where's the terminating semi-colon here?

    Code:
    void display_cat ();
    {
    ...
    }
    Copying and pasting prototypes without attention to detail often leads to this problem. Do you see it?

  3. #3
    Registered User
    Join Date
    Sep 2012
    Posts
    15
    that did it, thanks so much man!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 05-23-2012, 03:16 PM
  2. Replies: 4
    Last Post: 06-04-2007, 05:37 PM
  3. Why the hell haven't I used WinAmp before?
    By cboard_member in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 08-22-2006, 02:25 AM
  4. I haven't seen before! getch() doesn't work!
    By StefanA. in forum C++ Programming
    Replies: 8
    Last Post: 02-07-2003, 04:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21