fix please

HI. my coding not display an output as i want. my question project ask me to make menu interface application which is we can choose any number on menu. but my coding continued to calculate until end which is wrong. its will calculate when i choice the menu 3-5. anyone can fix this?

#include<iostream>
#include<string>
using namespace std;

float TPGP (float);
int TPC (int);
float PCGPA (float, int);
float TCGP (float);
int TCC (int);
float CCGPA (float, int);
float NewCGPA(float, float, int, int);

int main()
{
string name, matric, coursecode;
char another;
float sum1, sum3, Ppoint, Cpoint, a, c;
int *pointer1, *pointer2, sum2, sum4, i, j, b, d;
float point[6]={4.0, 3.5, 3.0, 2.5, 2.0, 1.0};
pointer1 = &i;
pointer2 = &j;

cout<<"\n";
cout<<"\n";
cout<<"CGPA Calculate Application"<<endl;
cout<<"==========================="<<endl;
cout<<"\n";
cout<<"\n1. Input Previous Student Info";
cout<<"\n2. Input Current Student Info";
cout<<"\n3. Calculate Previous CGPA";
cout<<"\n4. Calculate Current CGPA";
cout<<"\n5. Calculate New CGPA"<<endl;

do
{
cout<<"\nStudent Name: ";
cin.ignore();
getline(cin,name);
cout<<"Matric No.: ";
cin.ignore();
getline(cin,matric);

cout<<"\nPREVIOUS STUDENT INFO."<<endl;
cout<<"\n";
for(*pointer1=1; i<=4; i++)
{
cout<<"Course "<<i<<endl;
cout<<"Course Code : ";
cin.ignore();
getline(cin,coursecode);
cout<<"Point : ";
cin>>Ppoint;
if(Ppoint==point[0])
{
cout<<"Grade : A"<<endl;
}
else if(Ppoint==point[1])
{
cout<<"Grade : B+"<<endl;
}
else if(Ppoint==point[2])
{
cout<<"Grade : B"<<endl;
}
else if(Ppoint==point[3])
{
cout<<"Grade : C+"<<endl;
}
else if(Ppoint==point[4])
{
cout<<"Grade : C"<<endl;
}
else if(Ppoint==point[5])
{
cout<<"Grade : D"<<endl;
}
else
{
cout<<"Grade : F"<<endl;
}
cout<<"\n";
sum1+=Ppoint;
a=sum1;
sum2=i;
b=sum2;
}
cout<<"Total Previous Grade Point : "<<TPGP(a)<<endl;
cout<<"\nTotal Previous Credit : "<<TPC(b)<<endl;
cout<<"\nPrevious CGPA : "<<PCGPA(a,b)<<endl;

cout<<"\nCURRENT STUDENT INFO."<<endl;
cout<<"\n";
for(*pointer2=1; j<=4; j++)
{
cout<<"Course "<<j<<endl;
cout<<"Course Code : ";
cin.ignore();
getline(cin,coursecode);
cout<<"Point : ";
cin>>Cpoint;
if(Cpoint==point[0])
{
cout<<"Grade : A"<<endl;
}
else if(Cpoint==point[1])
{
cout<<"Grade : B+"<<endl;
}
else if(Cpoint==point[2])
{
cout<<"Grade : B"<<endl;
}
else if(Cpoint==point[3])
{
cout<<"Grade : C+"<<endl;
}
else if(Cpoint==point[4])
{
cout<<"Grade : C"<<endl;
}
else if(Cpoint==point[5])
{
cout<<"Grade : D"<<endl;
}
else
{
cout<<"Grade : F"<<endl;
}
cout<<"\n";
sum3+=Cpoint;
c=sum3;
sum4=j;
d=sum4;
}
cout<<"Total Current Grade Point : "<<TCGP(c)<<endl;
cout<<"\nTotal Current Credit : "<<TCC(d)<<endl;
cout<<"\nCurrent CGPA : "<<CCGPA(c,d)<<endl;
cout<<"\n";

cout<<"New CGPA : "<<NewCGPA(a,c,b,d)<<endl;
cout<<"\n\n";

cout<<"Calculate for another student (Y/N): ";
cin>>another;
}while(another=='Y'||another=='y');
return 0;
}

float TPGP (float a)
{
float value1=a;
return value1;
}

int TPC (int b)
{
int value2=b;
return value2;
}

float PCGPA (float a, int b)
{
float value3=a/b;
return value3;
}

float TCGP (float c)
{
float value4=c;
return value4;
}

int TCC (int d)
{
int value5=d;
return value5;
}

float CCGPA (float c, int d)
{
float value6=c/d;
return value6;
}

float NewCGPA (float a, float c, int b, int d)
{
float value7=(a+c)/(b+d);
return value7;
}
You already have thread http://www.cplusplus.com/forum/general/244902/
on this homework. You could have continued there.

Please, use code tags <> when posting code. See http://www.cplusplus.com/articles/jEywvCM9/


question project ask me to make menu interface application which is we can choose any number on menu.

I see no attempt to do anything like that in your code.
Topic archived. No new replies allowed.