C++ SIMPLE PROJECT FOR STORYING RECORDS OF STUDENTS
POST COMMENT FOR ANY ERROR OR IF YOU HAVE ANY PROBLEM WITH THE
CODE
#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
string name[3];
int id[3] ;
int count=0;
int z;
int y;
int ch;
int k;
int roll;
int c;
int dd;
char yy;
cout<<"*************************WELLCOME TO DATABASE SYSTM*********************"<<endl;
while(1)
{
cout<<"\t\tpress 1 for entry "<<endl;
cout<<"\t\tpress 2 for full data display "<<endl;
cout<<"\t\tpress 3 changing : "<<endl;
cout<<"\t\tpress 4 for exit "<<endl;
cin>>ch;
if(ch==1)
{ count++;
for(int x=0;x<3;x++)
{
cout<<"NAME :"<<endl;
cin>>name[x];
cout<<"ID :"<<endl;
cin>>id[x];
}
}
else if(ch==2)
{
if(count==0)
{
cout<<" SORRY NO DATA :"<<endl<<endl;
}
else if (count!=0)
{
cout<<"do you want to see full data press 1 or press 2 for indivial :"<<endl;
cin>>z;
if(z==1)
{
for(int i=0;i<3;i++)
{
cout<<"name of \t:"<<name[i]<<endl;
cout<<"id of \t:"<<id[i]<<endl;
}
}
else if(z==2)
{
cout<<"Searching BY ID PRESS 1 for by NAME PRESS 2:"<<endl;
cin>>k;
if(k==1)
{
cout<<"enter your roll no :"<<endl;
cin>>roll;
for(int i=0;i<3;i++)
{
if(roll==id[i])
{
cout<<"the roll found "<<endl<<"NAME :"<<name[i]<<" "<<"ROLL NUM :"<<id[i]<<endl;
}
}
}
if(k==2)
{
cout<<"enter your name :"<<endl;
cin>>na;
for(int i=0;i<3;i++)
{
if(na==name[i])
{
cout<<"the name found "<<endl<<endl<<"NAME :"<<name[i]<<" "<<"ROLL NUM :"<<id[i]<<endl<<endl;
}
}
}
} //************************************************************
else if(ch==3)
{
if(count==0)
{
cout<<"SORRY NO DATA :"<<endl;
}
else if(count !=0)
{
cout<<"ENTER ID TO CHANGE RECORD :"<<endl;
cin>>dd;
for(int i=0;i<3;i++)
{
if(id[i]==dd)
{
cout<<"RECORD FOUND :\t"<<"NAME : "<<name[i]<<" ID :"<<id[i]<<endl;
cout<<"do you want change it yes or no :"<<endl;
cin>>yy;
if(yy=='y')
{
cout<<"enter new name and id :"<<endl;
cout<<"NAME :"<<endl;
cin>>name[i];
cout<<"ID :"<<endl;
cin>>id[i];
cout<<"record change to "<<"NAME :"<<name[i]<<"id :"<<id[i]<<endl;
}
else if(yy=='n')
{
// break;
}
}
}
}
}
//***********************************
else if(ch==4)
{
cout<<"\t\tPROGRAM IS TERMINATING :"<<endl;
for(int x=1;x<100;x++)
{
cout<<".";
}
break;
}
else if(ch==5 || ch== 6 || ch==7 || ch==8 || ch== 9)
{
cout<<" INVALID "<<endl;
break;
}
}
}
POST COMMENT FOR ANY ERROR OR IF YOU HAVE ANY PROBLEM WITH THE
CODE
#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
string name[3];
int id[3] ;
int count=0;
int z;
int y;
int ch;
int k;
int roll;
int c;
int dd;
char yy;
cout<<"*************************WELLCOME TO DATABASE SYSTM*********************"<<endl;
while(1)
{
cout<<"\t\tpress 1 for entry "<<endl;
cout<<"\t\tpress 2 for full data display "<<endl;
cout<<"\t\tpress 3 changing : "<<endl;
cout<<"\t\tpress 4 for exit "<<endl;
cin>>ch;
if(ch==1)
{ count++;
for(int x=0;x<3;x++)
{
cout<<"NAME :"<<endl;
cin>>name[x];
cout<<"ID :"<<endl;
cin>>id[x];
}
}
else if(ch==2)
{
if(count==0)
{
cout<<" SORRY NO DATA :"<<endl<<endl;
}
else if (count!=0)
{
cout<<"do you want to see full data press 1 or press 2 for indivial :"<<endl;
cin>>z;
if(z==1)
{
for(int i=0;i<3;i++)
{
cout<<"name of \t:"<<name[i]<<endl;
cout<<"id of \t:"<<id[i]<<endl;
}
}
else if(z==2)
{
cout<<"Searching BY ID PRESS 1 for by NAME PRESS 2:"<<endl;
cin>>k;
if(k==1)
{
cout<<"enter your roll no :"<<endl;
cin>>roll;
for(int i=0;i<3;i++)
{
if(roll==id[i])
{
cout<<"the roll found "<<endl<<"NAME :"<<name[i]<<" "<<"ROLL NUM :"<<id[i]<<endl;
}
}
}
if(k==2)
{
cout<<"enter your name :"<<endl;
cin>>na;
for(int i=0;i<3;i++)
{
if(na==name[i])
{
cout<<"the name found "<<endl<<endl<<"NAME :"<<name[i]<<" "<<"ROLL NUM :"<<id[i]<<endl<<endl;
}
}
}
} //************************************************************
else if(ch==3)
{
if(count==0)
{
cout<<"SORRY NO DATA :"<<endl;
}
else if(count !=0)
{
cout<<"ENTER ID TO CHANGE RECORD :"<<endl;
cin>>dd;
for(int i=0;i<3;i++)
{
if(id[i]==dd)
{
cout<<"RECORD FOUND :\t"<<"NAME : "<<name[i]<<" ID :"<<id[i]<<endl;
cout<<"do you want change it yes or no :"<<endl;
cin>>yy;
if(yy=='y')
{
cout<<"enter new name and id :"<<endl;
cout<<"NAME :"<<endl;
cin>>name[i];
cout<<"ID :"<<endl;
cin>>id[i];
cout<<"record change to "<<"NAME :"<<name[i]<<"id :"<<id[i]<<endl;
}
else if(yy=='n')
{
// break;
}
}
}
}
}
//***********************************
else if(ch==4)
{
cout<<"\t\tPROGRAM IS TERMINATING :"<<endl;
for(int x=1;x<100;x++)
{
cout<<".";
}
break;
}
else if(ch==5 || ch== 6 || ch==7 || ch==8 || ch== 9)
{
cout<<" INVALID "<<endl;
break;
}
}
}
Comments
Post a Comment