-
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?
-
No. Post code and it will all be a whole lot clearer.
Aincient Chinese proverb:
One program worth thousand words!!
-
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.