problems in running my program
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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
#include<iostream>
#include<cstdlib>
using namespace std;
void pilih(char, char[][3], int, int);
void display(char[][3]);
void isi(char*, int, char, char [][3], int);
bool rules(char [][3]);
void decide(bool, int);
void menu();
bool select(char&);
bool menuBack(bool);
char grade( double mark);
char mark;
int main()
{
char num;
bool back;
do
{
menu();
back = select(num);
}
while(back == true);
system("pause");
}
void menu()
{
cout<<"\n------------WELCOME TO GRADE SYSTEM!!----------------"<<endl;
cout<<"---------------------------------------------------------"<<endl;
cout<<"| MENU |"<<endl;
cout<<"| |"<<endl;
cout<<"|1) ABOUT PROGRAMMERS 4) STUDENTS GRADE |"<<endl;
cout<<"| |"<<endl;
cout<<"|2) ABOUT GRADING 5) EXIT |"<<endl;
cout<<"| |"<<endl;
cout<<"|3) INSTRUCTIONS |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| THANK YOU!!! :) |"<<endl;
cout<<"---------------------------------------------------------"<<endl;
}
bool select(char& num)
{
int nums;
bool back2Menu = false;
bool kembali = false;
cout<<"\nEnter your choice: ";
cin>>num;
cout<<endl;
system("cls");
nums = static_cast<int>(num);
nums -= 48;
if(nums>=1 && nums<=5)
{
switch (nums)
{
case 1:
{
cout<<"\n ABOUT PROGRAMMERS "<<endl;
cout<<" ----------------- "<<endl;
cout<<"\n1)AINURISSA 2009868978 EE2503A "<<endl;
kembali = menuBack(back2Menu);
system("cls");
}
break;
case 2:
{
int numStud;
int numTest;
int numQuiz;
cout<<"*******************************************"<<endl;
cout<<"---------Students grade---------------------"<<endl<<endl;
cout<<"Please enter the number of students' data : ";
cin>>numStud;
cout<<"Number of test:";
cin>>numTest;
cout<<"Number of quiz:";
cin>>numQuiz;
string nameStud[numStud];
string id[numStud];
string part[numStud];
string code[numStud];
double test;
double quiz;
double fin;
string gred[numStud];
for(int c = 0; c<numStud; c++)
{
cout<<"Enter student name:";
cin>>nameStud[c];
cout<<"Enter student ID:";
cin>>id[c];
cout<<"Enter part:";
cin>>part[c];
cout<<"Enter course code:";
cin>>code[c];
double totalT = 0;
for(int t=0; t<numTest; t++)
{
cout<<"Enter Test "<<(t+1)<<":";
cin>>test;
totalT += test;
}
double totalQ = 0;
for(int q=0; q<numQuiz; q++)
{
cout<<"Enter Quiz "<<(q+1)<<":";
cin>>quiz;
totalQ += quiz;
}
cout<<"Enter final examination mark : ";
cin>>fin;
fin*=(60/100);
double total = totalT+totalQ+fin;
cout<<"The mark you get: "<<total<<endl;
cout<<"The gred :\n"<<grade(total);
}
return 0;
}
char grade( double mark);
{
char gred='a';
if(mark>=80 && mark<=100)
gred = 'A';
else if(mark>=70 && mark<80)
gred = 'B';
else if(mark>=60 && mark<70)
gred = 'C';
else if(mark>=50 && mark<60)
gred = 'D';
else if(mark>=40 && mark<50)
gred = 'E';
else if(mark>=0 && mark<40)
gred = 'F';
return gred;
}
case 3:
{
cout<<"\n INSTRUCTIONS "<<endl;
cout<<" ------------ "<<endl;
cout<<"\n1) Enter the student name properly. "<<endl;
cout<<"2) it is continue by the matrix number without exceed the maximum num of 10. "<<endl;
cout<<"3) Next,enter the part and the course. "<<endl;
cout<<"4) Then,select the place you want to use "<<endl;
cout<<"\n\n THANK YOU!!!"<<endl;
break;
kembali = menuBack(back2Menu);
system("cls");
}
}
{
menu();
select(num);
}
bool menuBack(bool back2Menu);
char back;
do
{
cout<<"\nBack to menu press 'M' or 'm'."<<endl;
cin>>back;
cout<<endl;
if(back == 'M' || back == 'm')
back2Menu = true;
}
while(back2Menu == false);
return back2Menu;
}
}
|
Can you describe what's wrong with your program? What doesn't work?
actually this is my program..
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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
#include<iostream>
#include<cstdlib>
using namespace std;
void pilih(char, char[][3], int, int);
void display(char[][3]);
void isi(char*, int, char, char [][3], int);
bool rules(char [][3]);
void decide(bool, int);
void menu();
bool select(char&);
bool menuBack(bool);
char grade( double mark);
char mark;
int main()
{
char num;
bool back;
do
{
menu();
back = select(num);
}
while(back == true);
system("pause");
}
void menu()
{
cout<<"\n------------WELCOME TO GRADE SYSTEM!!----------------"<<endl;
cout<<"---------------------------------------------------------"<<endl;
cout<<"| MENU |"<<endl;
cout<<"| |"<<endl;
cout<<"|1) ABOUT PROGRAMMERS 4) STUDENTS GRADE |"<<endl;
cout<<"| |"<<endl;
cout<<"|2) ABOUT GRADING 5) EXIT |"<<endl;
cout<<"| |"<<endl;
cout<<"|3) INSTRUCTIONS |"<<endl;
cout<<"| |"<<endl;
cout<<"| |"<<endl;
cout<<"| THANK YOU!!! :) |"<<endl;
cout<<"---------------------------------------------------------"<<endl;
}
bool select(char& num)
{
int nums;
bool back2Menu = false;
bool kembali = false;
cout<<"\nEnter your choice: ";
cin>>num;
cout<<endl;
system("cls");
nums = static_cast<int>(num);
nums -= 48;
if(nums>=1 && nums<=5)
{
switch (nums)
{
case 1:
{
cout<<"\n ABOUT PROGRAMMERS "<<endl;
cout<<" ----------------- "<<endl;
cout<<"\n1)AINURISSA 2009868978 EE2503A "<<endl;
kembali = menuBack(back2Menu);
system("cls");
}
break;
case 2:
{
int numStud;
int numTest;
int numQuiz;
cout<<"*******************************************"<<endl;
cout<<"---------Students grade---------------------"<<endl<<endl;
cout<<"Please enter the number of students' data : ";
cin>>numStud;
cout<<"Number of test:";
cin>>numTest;
cout<<"Number of quiz:";
cin>>numQuiz;
string nameStud[numStud];
string id[numStud];
string part[numStud];
string code[numStud];
double test;
double quiz;
double fin;
string gred[numStud];
for(int c = 0; c<numStud; c++)
{
cout<<"Enter student name:";
cin>>nameStud[c];
cout<<"Enter student ID:";
cin>>id[c];
cout<<"Enter part:";
cin>>part[c];
cout<<"Enter course code:";
cin>>code[c];
double totalT = 0;
for(int t=0; t<numTest; t++)
{
cout<<"Enter Test "<<(t+1)<<":";
cin>>test;
totalT += test;
}
double totalQ = 0;
for(int q=0; q<numQuiz; q++)
{
cout<<"Enter Quiz "<<(q+1)<<":";
cin>>quiz;
totalQ += quiz;
}
cout<<"Enter final examination mark : ";
cin>>fin;
fin*=(60/100);
double total = totalT+totalQ+fin;
cout<<"The mark you get: "<<total<<endl;
cout<<"The gred :\n"<<grade(total);
}
return 0;
}
char grade( double mark);
{
char gred='a';
if(mark>=80 && mark<=100)
gred = 'A';
else if(mark>=70 && mark<80)
gred = 'B';
else if(mark>=60 && mark<70)
gred = 'C';
else if(mark>=50 && mark<60)
gred = 'D';
else if(mark>=40 && mark<50)
gred = 'E';
else if(mark>=0 && mark<40)
gred = 'F';
return gred;
}
case 3:
{
cout<<"\n INSTRUCTIONS "<<endl;
cout<<" ------------ "<<endl;
cout<<"\n1) Enter the student name properly. "<<endl;
cout<<"2) it is continue by the matrix number without exceed the maximum num of 10. "<<endl;
cout<<"3) Next,enter the part and the course. "<<endl;
cout<<"4) Then,select the place you want to use "<<endl;
cout<<"\n\n THANK YOU!!!"<<endl;
break;
kembali = menuBack(back2Menu);
system("cls");
}
}
{
menu();
select(num);
}
bool menuBack(bool back2Menu);
char back;
do
{
cout<<"\nBack to menu press 'M' or 'm'."<<endl;
cin>>back;
cout<<endl;
if(back == 'M' || back == 'm')
back2Menu = true;
}
while(back2Menu == false);
return back2Menu;
}
}
|
but..
i want to put the menu or option as the early code that i had done.
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
|
#include <iostream>
#include <string>
using namespace std;
char grade( double mark);
int main()
{
int numStud;
int numTest;
int numQuiz;
cout<<"*******************************************"<<endl;
cout<<"---------Students grade---------------------"<<endl<<endl;
cout<<"Please enter the number of students' data : ";
cin>>numStud;
cout<<"Number of test:";
cin>>numTest;
cout<<"Number of quiz:";
cin>>numQuiz;
string nameStud[numStud];
string id[numStud];
string part[numStud];
string code[numStud];
double test;
double quiz;
double fin;
string gred[numStud];
for(int c = 0; c<numStud; c++)
{
cout<<"Enter student name:";
cin>>nameStud[c];
cout<<"Enter student ID:";
cin>>id[c];
cout<<"Enter part:";
cin>>part[c];
cout<<"Enter course code:";
cin>>code[c];
double totalT = 0;
for(int t=0; t<numTest; t++)
{
cout<<"Enter Test "<<(t+1)<<":";
cin>>test;
totalT += test;
}
double totalQ = 0;
for(int q=0; q<numQuiz; q++)
{
cout<<"Enter Quiz "<<(q+1)<<":";
cin>>quiz;
totalQ += quiz;
}
cout<<"Enter final examination mark : ";
cin>>fin;
fin*=(60/100);
double total = totalT+totalQ+fin;
cout<<"The mark you get: "<<total<<endl;
cout<<"The gred :\n"<<grade(total);
}
return 0;
}
char grade( double mark)
{
char gred='a';
if(mark>=80 && mark<=100)
gred = 'A';
else if(mark>=70 && mark<80)
gred = 'B';
else if(mark>=60 && mark<70)
gred = 'C';
else if(mark>=50 && mark<60)
gred = 'D';
else if(mark>=40 && mark<50)
gred = 'E';
else if(mark>=0 && mark<40)
gred = 'F';
return gred;
}
|
i just want to have an option for this program..
Topic archived. No new replies allowed.