class/functions Help

Discussion in 'C++' started by abyss, May 26, 2007.

  1. abyss

    abyss New Member

    May 26, 2007
    Likes Received:
    Trophy Points:
    Note: I think I posted this in the articles section by mistake and I reposting this in the discussion forum.

    I'm mainly trying to figure how to understand and implement classes/functions. I'm trying to create a program where the user enters yes or no, if there is a disc or a manual in a game case. Im just doing it as a starter program. Please dont flame, thank you!

    P.S., I'm really curious of what :: means in c++, does that have to do with classes or functions, just curious!

    #include stdlib.h
    #include iostream.h
    using namespace std;
    int main()
        char Gamecheck;
        cout << "Is there a disc?" << endl;
     cin >> DiscCheck >> endl;
    void Gamecheck::CheckDisc(int DiscCheck);
    { // check for cd
         if (DiscCheck == "yes")
         // make a statement for cd missing
         // remaining statement
    Last edited by a moderator: May 26, 2007
  2. shabbir

    shabbir Administrator Staff Member

    Jul 12, 2004
    Likes Received:
    Trophy Points:
    You have lots of points to note in the above code snippets.

    1. CheckDisc is a member function of some class Gamecheck
    2. You are trying to call it as normal function which is not syntactically correct.
    3. You are comparing int with string in the function CheckDisc.
    4. cin should be done on a variable and if its done on a function then the return type of the function should be reference. (Just ignore this if you dont understand ) Remember it should be on var as of now.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice