Hello
I'm doing my project in C++ now.
It's a Student Report Card Generator.
So here's what I plan on doing:
The file structure:
ROOT///
--> Report.exe
--> System Files
-------> License.dat
-------> ReadMe.txt
--> Reports
-------> Report 1
-------> Report 2
.
.
So, when the program is run, it looks in for License.dat file, and if found, it looks for its content and compares it with a string I have in a variable. If matched, loads the main menu, else exit.
Now, the problem is that I don't know how to make the file paths flexible. I mean, by default all files of C++ are saves in the TC folder in C:/. But if the user places the folder on desktop, how do I make sure that the program looks in it's own folder?
Another thing, how do I make a kind of a bar on the program, like split the screen so that the top portion will always contain the name of the program, and the bottom one does all the work I want.
I have looked at the window() function, but it doesn't seem to work fine. When I use clrscr(), the whole screen is gone (not the lower window), and clrwindow() doesn't seem to work. Asks for prototype.
Here's what I've one so far:
/*
Program To Haunt Students
Report Card Generator
By: Karan Goel
*/
//START HEADER FILES//
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<process.h>
#include<dos.h>
#include<direct.h>
//END HEADER FILES//
//START CLASS AND DECLARATION//
class report
{
public:
void mainmenu();
void generate();
void del();
void view();
void readme();
void close();
}r;
void report::mainmenu()
{
cout<<"\n\t\t###############################";
cout<<"\n\t\t##\tÄÅÅ MAIN MENU ÅÅÄ";
cout<<"\n\t\t##";
cout<<"\n\t\t## 1. Generate a new report";
cout<<"\n\t\t## 2. Delete an existing report";
cout<<"\n\t\t## 3. View an existing report";
cout<<"\n\t\t## 4. How to use (Read Me)";
cout<<"\n\t\t## 5. Exit";
cout<<"\n\t\t##";
cout<<"\n\t\t###############################";
}
void report::generate()
{}
void report::readme()
{}
void report::view()
{}
void report::del()
{}
void report::close()
{
cout<<"Exiting...";
delay(3000);
exit(1);
}
//END CLASS AND DECLARATION//
//START MAIN//
void main()
{
clrscr();
window(5,5,0,10);
textcolor(BLACK);
textbackground(WHITE);
cout<<"Report Generation\n";
int choice;
window(10,10,40,11);
r.mainmenu();
cout<<"\n\nEnter an input";
cin>>choice;
clrwindow();
switch(choice)
{
case 1: r.generate();
break;
case 2: r.del();
break;
case 3: r.view();
break;
case 4: r.readme();
break;
case 5: r.close();
break;
default: cout<<"No valid Input found";
break;
}
getch();
}
//END MAIN//
Please help me, and guide me.
I'll post more questions as I move forward.
Thanks a lot.
Karan
PS: I have both TC 3.0, and TC 4.5.