Answer to Question #5839 in C++ for uzzal
2012-01-05T08:39:50-05:00
Create a consol application of �Student Record System� using File and Structure
The application should have:
1. Add student record
2. Edit student record
3. Delete student record
4. Show all student record
Options.
1
2012-01-06T07:09:09-0500
// Student Record System.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <conio.h> #include <string> #include <vector> using namespace std; struct Student{ public: int id; string name; string suname; string grade; }; vector<Student> liststudent; void menu(){ cout<<"1. Add student record\n"; cout<<"2. Edit student record\n"; cout<<"3. Delete student record\n"; cout<<"4. Show all student record\n"; cout<<"5. Exit\n"; } void Addstudentrecord(){ Student st; cout<<"Enter ID:"; cin>>st.id; cout<<"Enter name:"; cin>>st.name; cout<<"Enter suname:"; cin>>st.suname; cout<<"Enter grade:"; cin>>st.grade; liststudent.push_back(st); cout<<"\n"; menu(); } void Editstudentrecord(){ vector<Student>::iterator iter; for(iter=liststudent.begin();iter!=liststudent.end();iter++) { cout<<(*iter).id; } } void Deletestudentrecord(int number_in){ vector<Student>::iterator iter = liststudent.begin(); vector<Student>::iterator endIter = liststudent.end(); for(; iter != endIter; ++iter) { endIter = liststudent.end(); } } void Showallstudentrecord(){ vector<Student>::iterator iter; cout<<"ID "<<" Name"<<" Surname"<<" Grade\n"; for(iter=liststudent.begin();iter!=liststudent.end();iter++) { cout<<(*iter).id<<" "<<(*iter).name<<" "<<(*iter).suname<<" "<<(*iter).grade<<"\n"; } cout<<"\n"; menu(); } int _tmain(int argc, _TCHAR* argv[]) { int ch=0; menu(); do{ cin>>ch; switch(ch){ case 1: Addstudentrecord(); break; case 2: Editstudentrecord(); break; case 3: Deletestudentrecord(1); break; case 4: Showallstudentrecord(); break; } }while(ch!=5); 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 !
Learn more about our help with Assignments:
C++
Comments
Leave a comment