Dec 12, 2014 at 7:10am UTC
When i run the program code,it shows "fatal error C1083: Cannot open include file: 'cstlib': No such file or directory"
This is the program code:
#include <iostream>
#include <cctype>
#include <cstring>
#include <cstlib>
using namespace std;
const int size=100;
struct student {
string name[60];
string id;
string course;
string courname;
}info[size];
void enter(),init_list(),display();
void update(),input(int i);
int menu();
int main()
{
char choice;
init_list();
for(;;) {
choice = menu();
switch(choice) {
case 'e':enter();
break;
case 'd':display();
break;
case 'u':update();
break;
case 'q':return 0;
}
}
}
void init_list()
{
int t;
for(t=0; t<size; t++) *student[t].name = '\0';
}
int menu()
{
char ch;
cout << '\n';
do {
cout << "(E)nter\n";
cout << "(D)ispaly\n";
cout << "(U)pdate\n";
cout << "(Q)uit\n\n";
cout << "Choose one: ";
cin >>ch;
}while(!strchr("eduq",tolower(ch)));
return tolower(ch);
}
void enter()
{
int i;
for(i=0; i<size; i++)
if(!*info[i].name) break;
if(i==size) {
cout << "List full.\n";
return;
}
input(i);
}
void input(int i)
{
cout << "Enter your name: ";
cin >>info[i].name;
cout << "Enter your id: ";
cin >> info[i].id;
cout << "Enter your course: ";
cin >> info[i].course;
cout << "Enter your course name: ";
cin >> "info[i].coursename;
}
void update()
{
int i;
string name[60];
cout << "Enter name: ";
cin >>name;
for(i=o; i<size; i++)
if(!strcmp(name,info[i].name)) break;
if(i==size) {
cout << "Name not found.\n";
return;
}
cout << "Enter new information.\n";
input(i);
}
void dispaly()
{
int t;
for(t=0; t<size; t++) {
if(*info[t].name) {
cout << info[t].name<< '\n';
cout << "Name: "<<info[t].name;
cout << "ID: " <<info[t].id;
cout << "Course code: "<<info[t].course;
cout << "Course name: "<<info[t].courname;
}
}
}
Last edited on Dec 12, 2014 at 7:11am UTC