Thread: Problem Arises Here!

  1. #1
    kohatian3279
    Guest

    Unhappy Problem Arises Here!

    i am getting input data from the user and want to get that compared to the ideal data i have already. then after that i am going to describe the user that in which fields there have been descripencies like he enters 50 instead of 80 and then i calculate the difference and assign marks accordingly, but the problem is that i am getting the data thru function calling and also dont want to use global variables, so how can i at the end of the program describe the user abt his inaccurate data?got the idea?

  2. #2
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    798
    No. Post code and it will all be a whole lot clearer.

    Aincient Chinese proverb:

    One program worth thousand words!!

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    one tip i can give you, encapsulate your program within a class. then you can have access to a class-scope data structure all the time. ie:

    Code:
    class kohation
    {
    public:
        int kMain();
        void InitIdealAnswers();
        LPVOID ArrayOfGoodAnswers();
        LPVOID TheirAnswers();
        
        void TakeInput();
        void CompareAnswers();
    };
    
    kohation kApp;
    
    int main(...)
    {
        return kApp.kMain();
    }
    
    int kMain()
    {
    InitIdealAnswers()
    TakeInput();
    CompareAnswers();
    }
    i cant be bothered typing anymore, but surely you get the idea. basically, use member functions of the instance of 'kohation' whereever you need to access the data of the class.
    its a typical approach used in windows programming, because it makes data more accessible, efficient, and organized. i can give you some examples, or better yet, just go to Ken Fitlikes site and look at his class-based code. its all windows stuff, but it gives you some good ideas about classes.

    http://www.foosyerdoos.fsnet.co.uk/

    its really good, it got me going. while you're there, you should read up on beginning windows programming. the program you described would benefit from a decent user interface, and frankly, the console is crap for that. good luck.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM