why is it not working ?

i dont know wht is wrong with my view function no error showing but when i m going to the view function option it does not show my detail but it goes to the main menu ..!!
void viewmoduledetail(int ID){
system("cls");
bool found=true;
int i,j;
readModuleDetailsfile();
cout<<"\n\t\--------STUDENT MANAGEMENT SYSTEM------------";
cout<<"\n\t\-----------------------VIEW MODULE DETAILS----------------------------";
j= moduleF.size();
for(i=0;i <j;i++)
{
if(moduleF[i].getstudentID()==ID)
{
found=true;
cout<<"\n\n Degree ID : "<<moduleF[i].getModuleID();
cout<<"\nModule 1 : "<<moduleF[i].getMname1();
cout<<"\nExam Marks : "<<moduleF[i].getmarks1();
cout<<"\nAssignment marks : "<<moduleF[i].getass1();
cout<<"\n\Module 2 : "<<moduleF[i].getMname2();
cout<<"\nExam Marks : "<<moduleF[i].getmarks2();
cout<<"\nAssignment Marks : "<<moduleF[i].getass2();
cout<<"\nModule 3 : "<<moduleF[i].getMname3();
cout<<"\nExam Marks : "<<moduleF[i].getmarks3();
cout<<"\nAssignment Marks : "<<moduleF[i].getass3();
cout<<"\nHome Availability : ";
if(moduleF[i].getAvailability()==true)
cout<<"True"<<endl;
else
cout<<"False"<<endl;
cout<<"\n********************************************************\n";
system("pause");
}
}
if(found==false)
cout<<"\n\nWARNING: Module Details cannot be found"<<endl;
}
Use [code] tags pls
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
void viewmoduledetail(int ID)
{
	system("cls");
	bool found=true;
	int i,j;
	
	readModuleDetailsfile();
	cout<<"\n\t\--------STUDENT MANAGEMENT SYSTEM------------";
	cout<<"\n\t\-----------------------VIEW MODULE DETAILS----------------------------";
	
	j = moduleF.size();
	for(i=0; i<j; i++)
	{
		if(moduleF[i].getstudentID()==ID)
		{
			found = true;
			cout<<"\n\n Degree ID : "<<moduleF[i].getModuleID();
			cout<<"\nModule 1 : "<<moduleF[i].getMname1();
			cout<<"\nExam Marks : "<<moduleF[i].getmarks1();
			cout<<"\nAssignment marks : "<<moduleF[i].getass1();
			cout<<"\n\Module 2 : "<<moduleF[i].getMname2();
			cout<<"\nExam Marks : "<<moduleF[i].getmarks2();
			cout<<"\nAssignment Marks : "<<moduleF[i].getass2();
			cout<<"\nModule 3 : "<<moduleF[i].getMname3();
			cout<<"\nExam Marks : "<<moduleF[i].getmarks3();
			cout<<"\nAssignment Marks : "<<moduleF[i].getass3();
			cout<<"\nHome Availability : ";
			if(moduleF[i].getAvailability()==true)
				cout<<"True"<<endl;
			else
				cout<<"False"<<endl;

			cout<<"\n********************************************************\n";
			system("pause");
		}
	}
	if(found==false)
		cout<<"\n\nWARNING: Module Details cannot be found"<<endl;
}


This is very horribly written code. But at least now it can be read.

What exactly is your code supposed to do? You only gave us the details of one method.
It should be obvious, but nothing in this code is going to tell you or us why it doesn't work.
We need to see the code in the "getstudentID()" method.
And it would probably help to see the design of "moduleF[i]" as well.
Also:
bool found=true;
You want to set found to false, otherwise it will always be true.

for(i=0; i<j; i++)
Get into the habit of typing "++i" instead of "i++".
Topic archived. No new replies allowed.