- #include<iostream.h>
-
#include<conio.h>
-
#include<string.h>
-
#include<fstream.h>
-
class student
-
{
-
private:
-
int adm,scl;
-
char sname[15],ssec;
-
public:
-
void add(void)
-
{
-
clrscr();
-
cout << "\n\n\nEnter Student Information :";
-
cout << "\n\n Student No :";
-
cin >> adm;
-
cout << "\n\n Student Name :";
-
cin >> sname;
-
cout << "\n\n Student Class :";
-
cin >> scl;
-
cout << "\n\n Student Section :";
-
cin >> ssec;
-
}
-
void mod(int no,int tstd,student *as)
-
{
-
}
-
void del(int no,int tstd,student *as)
-
{
-
}
-
-
void vie(void)
-
{
-
}
-
-
};
-
class book
-
{
-
private:
-
int bno,bprice;
-
char bname[15],bauthor[15];
-
public:
-
void add(void)
-
{
-
-
}
-
void mod(void)
-
{
-
-
}
-
void del(void)
-
{
-
-
}
-
void vie(void)
-
{
-
-
}
-
-
};
-
void main()
-
{
-
int i,ch,sub,sinput;
-
mainmenu:
-
clrscr();
-
cout << " Main Menu \n";
-
cout << " ~~~~~~~~~\n\n\n\n";
-
cout << " 1.....Master\n\n";
-
cout << " 2.....Borrow Book\n\n";
-
cout << " 3.....Received Book\n\n";
-
cout << " 0.....Exit\n\n";
-
cout << " ---------------------\n\n";
-
cout << " Select : ";
-
cin >> ch;
-
if (ch==1)
-
{
-
goto submenu;
-
}
-
else if(ch==2)
-
{
-
goto borrowmenu;
-
}
-
else if(ch==3)
-
{
-
goto receivemenu;
-
-
}
-
else if(ch==0)
-
{
-
cout << "\n\n\n Thanks for visit my project....";
-
getch();
-
return;
-
}
-
else
-
{
-
cout << "\n\n\n Invalid choice try again : ";
-
getch();
-
goto mainmenu;
-
}
-
submenu:
-
clrscr();
-
cout << " Submenu\n";
-
cout << " ~~~~~~~\n\n\n\n";
-
cout << " 1...Student\n\n";
-
cout << " 2...Books\n\n";
-
cout << " 0...Back\n\n";
-
cout << " --------------\n\n";
-
cout << " Select : ";
-
cin >> sub;
-
if(sub==1)
-
{
-
goto studentmenu;
-
}
-
else if(sub==2)
-
{
-
goto bookmenu;
-
}
-
else if(sub==0)
-
{
-
goto mainmenu;
-
}
-
else
-
{
-
cout << "\n\n Invalid choice :";
-
goto submenu;
-
}
-
-
studentmenu:
-
clrscr();
-
cout << "\n\n\n This is student menu :";
-
cout << "\n\n 1... Add student ";
-
cout << "\n\n 2....Modify Student";
-
cout << "\n\n 3....Delete Student";
-
cout << "\n\n 4....View Student";
-
cout << "\n\n 0....Back";
-
cout << "\n\n ------------------------- ";
-
cout << "\n\n select : ";
-
cin >> sinput;
-
-
if(sinput==1)
-
{
-
goto addstudent;
-
}
-
else if(sinput==2)
-
{
-
goto modifystudent;
-
}
-
else if(sinput==3)
-
{
-
goto deletestudent;
-
}
-
else if(sinput==4)
-
{
-
goto viewstudent;
-
}
-
else if(sinput==0)
-
{
-
goto submenu;
-
}
-
else
-
{
-
cout << "\n\n Invalid choice :";
-
goto studentmenu;
-
}
-
goto submenu;
-
-
bookmenu:
-
clrscr();
-
cout << "\n\n\n This is book menu :";
-
getch();
-
goto submenu;
-
-
borrowmenu:
-
clrscr();
-
cout << "\n\n\n This is borrow menu :";
-
getch();
-
goto mainmenu;
-
-
receivemenu:
-
clrscr();
-
cout << "\n\n\n This is receive menu :";
-
getch();
-
goto mainmenu;
-
-
-
-
-
addstudent:
-
clrscr();
-
cout << "\n\n\n This is Add New Student menu :";
-
student s;
-
s.add();
-
ofstream obj1("std.txt");
-
obj1.write((char *)&s,sizeof(s));
-
obj1.close();
-
getch();
-
goto studentmenu;
-
-
modifystudent:
-
clrscr();
-
cout << "\n\n\n This is Modify Old Student menu :";
-
getch();
-
goto studentmenu;
-
-
deletestudent:
-
clrscr();
-
cout << "\n\n\n This is Delete Old Student menu :";
-
getch();
-
goto studentmenu;
-
-
viewstudent:
-
clrscr();
-
cout << "\n\n\n This is View Student menu :";
-
cout << "\n--------------------------------------------------------------------------";
-
getch();
-
goto studentmenu;
-
}
2 2515
I dont know what you mean with "my file managment code, otherwise its fine", but I do see a lot of goto's which is a bad thing, since they ruin program flow and make it less readable.Generally, you can write every structured programme without using goto's and in most cases you should go that way.So use goto's only when they are necessary (which is a rare thing) and use other language constructs to structure your code in a more readable form.
Also, this might be a good read :)
Regards
Tarun,
C and C++ both have a switch statement. Use of the statement can really make your life easier.
Savage pointed out the "goto" issue your code has; but that's not what's causing you grief at the moment.
To find the "Unreachable Code", read your complier's error message and go to the line it calls out. The problem is likely the line immediately preceeding.
Luck!
Orally
Sign in to post your reply or Sign up for a free account.
Similar topics
by: kaiwing18 |
last post by:
Hi ,
I use apache server , php and mysql to
implement a multi-language web admin
system, in order to display the required
language, the file needed to save with
unicode instead of ANSI. But...
|
by: TempEcho |
last post by:
Is there any place where I can find some library / commands to use for file
management (e.g. renaming files , copying , deleting?). Thanks in advance!
T.E.
|
by: Carlos |
last post by:
Does anyone know a good "file management" ASP.NET program out there, so I
can get it and learn how to do it ?
Thanks
|
by: Matthias H. |
last post by:
Hi guys,
Our team has a very strange problem. I hope anybody can help.
We have a class called webpage and all our aspx-pages bases on it. Then we
have a SYS.IO.File Class which have a...
|
by: Alan Silver |
last post by:
Hello,
I have been developing ASP.NET with a text editor so far (better way to
learn initially), and have now been trying Visual Web Developer. I want
to create a project for an existing site...
|
by: s |
last post by:
I need to coordinate file management between three computers.
Users need to enter all file names and would like to store file
names,date changed,person
changed etc. into a database. User...
|
by: yazwas |
last post by:
Hi,
I'm looking for a file management library in C++, i.e library that has
createfile, readfile, movefile, ...etc I need it for linux espically,
it no general one is available
does anyone have...
|
by: systemonkey |
last post by:
I have a lot of huge files on a server and I can't risk getting deleted by anyone. What I have been doing is I create a ftp account for users and create a hardlinks to the original file in case...
|
by: mzmishra |
last post by:
Hi,
I have one page developed in C# ASP.NET 2.0.
I am trying to open a new window from my code behind file.
My code is like below
string pageName = "EntityDescription.aspx?Ecode=" + "'" +...
|
by: lgwapnitsky |
last post by:
I am writing an Outlook add-in that needs to fire when a PST is added/removed. I have successfully fired the event using the AddStore and RemoveStore functions, as well as when I use the "Open ->...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| | |