HII ... i was doing this program where i can enter student grades and the program will tell me like the over-roll grade .. and stuff .. i am almost done i think but i am stuck now soo plz if u can make this work plz help .. THANK YOU

#include<iostream.h>
#include<iomanip.h>
void main (void)
{
	double ID[100], MExam1[100], MExam2[100], FExam[100], Overall1[100];
	char Grade1[100],N,i,A,B,C,D,F;
	
	do{
		cout<<"\n<<How many Students will be entered? N= ";
		cin>>N;

		for (i=1; i<=N; i++)
		{
			cout<<"\n\n<<Enter Student's ID number: ";
			cin>>ID[i];
			cout<<"\n<<Enter Student's First Midterm Exam Grade: ";
			cin>>MExam1[i];
			cout<<"\n<<Enter Student's Second Midterm Exam Grade: ";
			cin>>MExam2[i];
			cout<<"\n<<Enter Student's Final Exam Grade: ";
			cin>>FExam[i];

			Overall1[i]=MExam1[i]*0.3+MExam2[i]*0.3+FExam[i]*0.4;
		}
		 
	
		do{

		
			if(Overall1[i]>89)
			{

				cout<<endl<<"Grade1[i]="<<'A';
			}

					else if(Overall1[i]>79)
					{
						cout<<endl<<"Grade1[i]="<<'B';
					}

						else if(Overall1[i]>69)
						{

						cout<<endl<<"Grade1[i]<<="<<'C';
						}
						
							else if(Overall1[i]>59)
							{
							
							cout<<endl<<"Grade1i]="<<'D';
							}

							else 

								{
									cout<<endl<<"Grade1[i]="<<'F';
										
								}
						

							while(Grade1[i]>=0 && Grade1[i]<=100);
		
								
								
		cout<<"\n\n\nStudent ID#      MTI      MTII      Final     Overall      Grade";
		cout<<"\n====================================================================";
		
		for (i=0; i<=N-1; i++)
		 {
			cout<<"\n\n Student ID#"<<ID[i]<<"\t";
			cout<<"\n"<<setprecision(3)<<setw(5)<<MExam1[i]<<"\t";
			cout<<"\n"<<setprecision(3)<<setw(5)<<MExam2[i]<<"\t";
			cout<<"\n"<<setprecision(3)<<setw(5)<<FExam[i]<<"\t";
			cout<<"\n"<<setprecision(3)<<setw(4)<<Overall1[i]<<"\t";
			cout<<"\n"<<setprecision(3)<<setw(4)<<Grade1[i]<<"\t";
		}
				
	}

line 12: for (i=1; i<=N; i++)

Array elements always begin with 0, not with 1. So when that loop reaches N the value of i will be beyond the range of the arrays. The loop should be coded like this: for( i = 0; i < N; i++) >>the program will tell me like the over-roll grade .. and stuff
You need to be just a tad bit more technical and explict in your description. "and stuff" doesn't tell us anything.

Welcome to DaniWeb!

First, please use real English words. E.g "plz" is not a word.

Second, please tell us what is wrong? What is the input? What is the current output? What is the expected output? Are there any compiler errors?

These things will help us help you as efficiently as possible.

David

Write a program to Calculate student Grades.

1- The Program will run for N Student N will Be entered by user.
2-the user will also enter studernt Id number, first midterm and second midterm exam grades and the final exam grade
3. the program will calculate an " overrall Score" ..
midtrem exams 30% each and final exam 40% of the overrall score.

overrall=MExam1 * 0.3 + MExam2 * 0.3 +FExam * 0.4
=(MExam1 + MExam2)*0.3+ FExam *0.4

the program will display the result in a tabbular fashion as shown below
Student ID# MTI MTII Final Overall Grade
================================================================
123452 71 82 93 83.1 B

....


THank YOu

#include<iostream.h>#include<iomanip.h>void main (void){	double ID[100], MExam1[100], MExam2[100], FExam[100], Overall1[100];	char Grade1[100],N,i,A,B,C,D,F; 	do{		cout<<"\n<<How many Students will be entered? N= ";		cin>>N; 		for (i=1; i<=N; i++)		{			cout<<"\n\n<<Enter Student's ID number: ";			cin>>ID[i];			cout<<"\n<<Enter Student's First Midterm Exam Grade: ";			cin>>MExam1[i];			cout<<"\n<<Enter Student's Second Midterm Exam Grade: ";			cin>>MExam2[i];			cout<<"\n<<Enter Student's Final Exam Grade: ";			cin>>FExam[i]; 			Overall1[i]=MExam1[i]*0.3+MExam2[i]*0.3+FExam[i]*0.4;		}  		do{  			if(Overall1[i]>89)			{ 				cout<<endl<<"Grade1[i]="<<'A';			} 					else if(Overall1[i]>79)					{						cout<<endl<<"Grade1[i]="<<'B';					} 						else if(Overall1[i]>69)						{ 						cout<<endl<<"Grade1[i]<<="<<'C';						} 							else if(Overall1[i]>59)							{ 							cout<<endl<<"Grade1i]="<<'D';							} 							else  								{									cout<<endl<<"Grade1[i]="<<'F'; 								}  							while(Grade1[i]>=0 && Grade1[i]<=100);   		cout<<"\n\n\nStudent ID#      MTI      MTII      Final     Overall      Grade";		cout<<"\n===================================================================="; 		for (i=0; i<=N-1; i++)		 {			cout<<"\n\n Student ID#"<<ID[i]<<"\t";			cout<<"\n"<<setprecision(3)<<setw(5)<<MExam1[i]<<"\t";			cout<<"\n"<<setprecision(3)<<setw(5)<<MExam2[i]<<"\t";			cout<<"\n"<<setprecision(3)<<setw(5)<<FExam[i]<<"\t";			cout<<"\n"<<setprecision(3)<<setw(4)<<Overall1[i]<<"\t";			cout<<"\n"<<setprecision(3)<<setw(4)<<Grade1[i]<<"\t";		} 	}#include<iostream.h>
#include<iomanip.h>
void main (void)
{
	double ID[100], MExam1[100], MExam2[100], FExam[100], Overall1[100];
	char Grade1[100],N,i,A,B,C,D,F;
	
	do{
		cout<<"\n<<How many Students will be entered? N= ";
		cin>>N;

		for (i=1; i<=N; i++)
		{
			cout<<"\n\n<<Enter Student's ID number: ";
			cin>>ID[i];
			cout<<"\n<<Enter Student's First Midterm Exam Grade: ";
			cin>>MExam1[i];
			cout<<"\n<<Enter Student's Second Midterm Exam Grade: ";
			cin>>MExam2[i];
			cout<<"\n<<Enter Student's Final Exam Grade: ";
			cin>>FExam[i];

			Overall1[i]=MExam1[i]*0.3+MExam2[i]*0.3+FExam[i]*0.4;
		}
		 
	
		do{

		
			if(Overall1[i]>89)
			{

				cout<<endl<<"Grade1[i]="<<'A';
			}

					else if(Overall1[i]>79)
					{
						cout<<endl<<"Grade1[i]="<<'B';
					}

						else if(Overall1[i]>69)
						{

						cout<<endl<<"Grade1[i]<<="<<'C';
						}
						
							else if(Overall1[i]>59)
							{
							
							cout<<endl<<"Grade1i]="<<'D';
							}

							else 

								{
									cout<<endl<<"Grade1[i]="<<'F';
										
								}
						

							while(Grade1[i]>=0 && Grade1[i]<=100);
		
								
								
		cout<<"\n\n\nStudent ID#      MTI      MTII      Final     Overall      Grade";
		cout<<"\n====================================================================";
		
		for (i=0; i<=N-1; i++)
		 {
			cout<<"\n\n Student ID#"<<ID[i]<<"\t";
			cout<<"\n"<<setprecision(3)<<setw(5)<<MExam1[i]<<"\t";
			cout<<"\n"<<setprecision(3)<<setw(5)<<MExam2[i]<<"\t";
			cout<<"\n"<<setprecision(3)<<setw(5)<<FExam[i]<<"\t";
			cout<<"\n"<<setprecision(3)<<setw(4)<<Overall1[i]<<"\t";
			cout<<"\n"<<setprecision(3)<<setw(4)<<Grade1[i]<<"\t";
		}
				
	}

Its Doesn't Run This is the far i went ..
THank YOu

Comments
Horribly messy and unstructured. Still hasn't described the problem.

well if you look at your code closely particularly the do-while loop...you have only 2 do's and 1 while...and dont forget to pair all brackets {}

Edited 6 Years Ago by Anyzen: n/a

This article has been dead for over six months. Start a new discussion instead.