}
}
return 0;
}
int cleardata (cl)
{
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 10; j++)
{
cl[i][j].Subject == " ";
cl[i][j].Lecturer == " ";
cl[i][j].RoomNo == " ";
}
}
cout << setw (15) << "TIMETABLE\n";
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 10; j++)
{
cout << setw (15) << cl[i][j].timee;
}
}
cout << "\n";
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 10; j++)
{
cout << setw (15) << cl[i][j].days << setw (15) << cl[i][j].
Subject << setw (15) << cl[i][j].
Lecturer << setw (15) << cl[i][j].RoomNo;
}
}
return 0;
}
int show (cl)
{
cout << "\nEnter Time (0(9:00),1(10:00),2(11:00),3(12:00),4(1:00),5(2:00),6(3:00),7(4:00),8(5:00)):\n";
cin >> cl.tm;
cout << "Enter Day (Mon,Tue,Wed,Thur,Fri):\n";
cin >> cl.dy;
for (int i = 0; i < 10; i++)
{
if (cl.timee[i] == cl.tm)
{
cl.z = i;
}
for (int j = 0; j < 6; j++)
{
if (cl.days[j] == cl.dy)
{
cl.a = j;
}
}
}
return 0;
}
int showtimetable (cl)
{
cout << setw (15) << "TIMETABLE\n";
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 10; j++)
{
cout << setw (15) << cl[i][j].timee;
}
}
cout << "\n";
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 10; j++)
{
cout << setw (15) << cl[i][j].days << setw (15) << cl[i][j].
Subject << setw (15) << cl[i][j].
Lecturer << setw (15) << cl[i][j].RoomNo;
}
return 0;
}
int data (TTcell cl)
{
cout << "\nEnter No of Rows and Coloumns\n";
cin >> cl.n;
cout << "\n";
cin >> cl.m;
do
{
cout << "Choose the option:\n";
cout << "1.Clear Timetable\n";
cout << "2.Insert Timetable\n";
cout << "3.Show \n";
cout << "4.Show Timetable\n";
cin >> cl.ch;
switch (cl.ch)
{
case 1:
Cleardata (cl);
break;
case 2:
insertdata (cl);
break;
case 3:
show (cl);
break;
case 4:
showtimetable (cl);
break;
}
cout << "Do you want to access the menu?\n";
cin >> cl.c;
}
while (cl.c == 'y' || cl.c == 'Y');
return 0;
}
int main ()
{
TTcell cl;
do
{
cout << "Enter the Timetable you want to access:\n";
cout << "1.Winter\n";
cout << "2.Spring\n";
cout << "3.Summer\n";
cout << "4.Autumn\n";
cin >> cl.cd;
switch (cl.cd)
{
case 1:
cout << "Timetable for Winter\n";
data (cl);
break;
case 2:
cout << "Timetable for Spring\n";
data (cl);
break;
case 3:
cout << "Timetable for Summer\n";
data (cl);
break;
case 4:
cout << "Timetable for Autumn\n";
data (cl);
break;
}
cout << "Want to enter Timetable of other season?\n";
cin >> cl.g;
}
while (cl.g == 'y' || cl.g == 'Y');
return 0;
}
Lets have a function declaration: int foo( bar );
What is the 'foo'? The name of function.
What is the 'bar'? The type of function's argument.
Again: int foo( bar gaz );
What is the 'foo'? The name of function.
What is the 'bar'? The type of function's argument.
What is the 'gaz'? The name of function's argument.
Again: int insertdata ( cl )
Is 'cl' a name of a type? It should be, but is it? What type of argument should this function take?
What is the name of the argument, whose type is 'cl'? We don't know.
Lets look at how we get to the insertdata(). At least one path:
The main():
1 2
TTcell foo;
data( foo );
The data()
1 2 3 4
int data( TTcell bar )
{
insertdata( bar );
}
If insertdata() is called with TTcell argument, should it then be: int insertdata ( TTdata gaz )
Why your functions return int even though they seem to return no useful data?