Answer to Question #73348 in C++ for Urishita pandita

Question #73348
Can you please give me the code on the topic "SCHOOL ADMISSION" using structures.
1
Expert's answer
2018-02-12T07:37:12-0500
#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
#include <windows.h>
using namespace std;


struct student
{
string name;// student first name and last name
string classes;//for class info
string id;// identification number

}DataStudent;
int main()
{

int n=0,m;
char variable;
string f;
string s;
while(true)
{
system("cls"); //Lvl 1-Display


cout<<"................................................................................................................";
cout<<"\n\n\t\t\t SCHOOL ADMISSION \n\n";
cout<<"................................................................................................................";
cout<<"\n\n\t\t\tMAIN PAGE\n\n";
cout<<"Pute your choice: "<<endl;
cout<<"1.Students information"<<endl;
cout<<"2.Exit program"<<endl;
cin >> variable;
system("cls");

switch(variable)// switch 1.0
{
case '1':
{
while(1)
{
system("cls");
//Lvl-2 display
cout<<"\t\t\t STUDENTS INFO AND BIO DATA SECTION\n\n\n";
cout<<"Pute your choice: "<<endl;
cout<<"1.Create new entry\n";
cout<<"2.Find and display entry\n";
cout<<"3.Jump to main\n";
cin >> cvariable;

switch (variable )//switch 2.0

{
case '1'://Insert data
{ ofstream file1("student.txt",ios::app);

for( n =0;variable !='n';n++)
{
if((variable=='y')||(variable=='Y')||(variable=='1'))
{
cout<<"Enter Name: ";
cin>>DataStudent.Nname;
cout<<"Enter ID: ";
cin>>DataStudent.id;
cout<<"Enter class: ";
cin>>DataStudent.classes;

f1<<DataStudent.Name<<endl<<DataStudent.ID<<endl<<DataStudent.classes<<endl;
cout<<"Do you want to enter data: ";
cout<<"Press Y for Continue and N to Finish: ";
cin>>variable;
}
}
f1.close();
}
continue;

case '2':
{ ifstream f2("student.txt");

cout<<"Enter name to be displayed: ";
cin>>f;
cout<<endl;
int notFound = 0;

for( m=0;(m<n)||(!f2.eof());m++)
{
getline(f2,DataStudent.Name);

if(DataStudent.Name==f)
{
notFound = 1;
cout<<"Name: "<<DataStudent.Name<<endl;


getline(f2,DataStudent.ID);
cout<<"ID No number: "<<DataStudent.ID<<endl;
getline(f2,DataStudent.classes);
cout<<"Class: "<<DataStudent.classes<<endl<<endl;
}
}

if(notFound == 0){

cout<<"No Found"<<endl;
}
f2.close();
cout<<"Press any key two times ";
getch();//To hold data on screen
}
continue;

case '3':
{
break;
}
}

break;
}
continue;
}
}
}
return 0 ;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS