1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
#include<iostream>
#include<string>
#include<conio.h>
#include<cctype>
using namespace std;
bool valid( string str )
{
static const string pattern = "0000-00-0000" ;
for( size_t i = 0 ; i < str.size() ; ++i )
if( isdigit( str[i] ) ) str[i] = '0' ;
return str == pattern ;
}
int main()
{
char myinput;
string nam[100],add[100],con[100],cor[100],yel[100];
string search;
string idn[100];
int num_rec,a;
do
{
system("cls");
cout << "\t\t====== STUDENT INFORMATION SYSTEM ======";
cout <<"\n\n ";
cout << "\n\n";
cout<<" \n\t\t\t======================";
cout << "\n \t\t\t [1] Add Records";
cout << "\n \t\t\t [2] Search Records";
cout << "\n \t\t\t [3] Modify Records";
cout << "\n \t\t\t [4] Delete Records";
cout << "\n \t\t\t [5] Exit Program";
cout<<" \n\t\t\t======================";
cout << "\n\n";
cout << "\t\t\t Select Your Choice :: ";
cin >> myinput;
switch (myinput)
{
case '1':
{
system("cls");
cout<<"** Number of records to be entered (MAXIMUM OF 10) **"<<endl;
cout<<"# ";
cin>>num_rec;
cin.ignore();
if (num_rec < 11)
{
for (a=0; a<num_rec; a++)
{
cout<<"Enter your ID number:: ";
getline (cin, idn[a]);
if( !valid(idn[a]) ) cout << "you have entered an incorrect ID PATTERN\n" ;
cout<<"Enter your Name:: ";
getline (cin, nam[a]);
cout<<"Enter your Address:: ";
getline (cin, add[a]);
cout<<"Enter your Contact Information:: ";
getline (cin, con[a]);
cout<<"Enter your Course:: ";
getline (cin, cor[a]);
cout<<"Enter your Year Level:: ";
getline (cin, yel[a]);
cout<<"\n\n\n You have Successfully entered the record"<<endl;
}
}
else
{
cout<<" The system cannot handle more than "<<num_rec<<" records"<<endl;
}
cout<<"\n\n\n\n\n************************************************"<<endl;
cout<<"***Please press any key to return to the Menu***"<<endl;
cout<<"************************************************"<<endl;
getch();
break;
}
case '2':
{
system("cls");
cout<<"** Search and display student's details **"<<endl;
cout<<"Type student's ID NUMBER : ";
cin>>search;
cin.ignore();
for (a=0; a<num_rec ; a++)
{
if (search == idn[a])
{
cout<<":: STUDENT ID ::";
cout<<idn[a]<<endl;
cout<<":: NAME ::";
cout<<nam[a]<<endl;
cout<<":: ADDRESS ::";
cout<<add[a]<<endl;
cout<<":: CONTACT INFORMATION ::";
cout<<con[a]<<endl;
cout<<":: COURSE ::";
cout<<cor[a]<<endl;
cout<<":: YEAR LEVEL ::";
cout<<yel[a];
}
else
{
cout<<"NO RECORDS FOUND"<<endl;
}
}
cout<<"\n\n\n\n\n************************************************"<<endl;
cout<<"***Please press any key to return to the Menu***"<<endl;
cout<<"************************************************"<<endl;
getch();
break;
}
case '3':
{
system("cls");
cout<<"Modify/edit the current student's info"<<endl;
cout<<"\n\nType student's ID NUMBER : ";
cin>>search;
for (a=0; a<num_rec ; a++)
{
if (search == idn[a])
{
cout<<"Enter your Name:: ";
getline (cin, nam[a]);
cout<<"Enter your Address:: ";
getline (cin, add[a]);
cout<<"Enter your Contact Information:: ";
getline (cin, con[a]);
cout<<"Enter your Course:: ";
getline (cin, cor[a]);
cout<<"Enter your Year Level:: ";
getline (cin, yel[a]);
cout<<"\n\n\n You have Successfully modified the record"<<endl;
}
else
{
cout<<" RECORD NOT FOUND"<<endl;
}
}
cout<<"\n\n\n\n\n************************************************"<<endl;
cout<<"***Please press any key to return to the Menu***"<<endl;
cout<<"************************************************"<<endl;
getch();
break;
}
case '4':
{
cout<<"gettin' shit done.so wait nigga >:O press any button!";
getch();
break;
}
}
}
while(myinput>=5);
return 0;
}
|