I need a hlep in c++  | |
December 23rd, 2003, 02:47 PM
|
#1 (permalink)
| | Junior Member
Join Date: Dec 2003
Posts: 5
|
hey guys
i a new member and i need a help in c++ ,I have a project in array
this project about student and grades.
first must show a choise as following:
1)add grade for a new student.
2)update grade for a student .
3)Display grade of a Student.
4)Display grade for all Students
5)Sorting grade of a Student
6)Sorting Student by a verage
7)Exit.
please help me |
| |
December 23rd, 2003, 02:52 PM
|
#2 (permalink)
| | Junior Member
Join Date: Dec 2003
Posts: 5
|
#include<iostream.h>
this is begin
int main()
{
int x,student=0,i=100, n=0;
const int j=5;
float a[j];
first : cout<<"Chose form this option:\n\n";
cout<<"1)Add grade for new a Student\n\n";
cout<<"2)Update grade for a Student\n\n";
cout<<"3)Display grade of a Student\n\n";
cout<<"4)Display grade for all Students\n\n";
cout<<"5)Sorting grade of a Student\n\n";
cout<<"6)Sorting Student by a verage\n\n";
cout<<"7)Exit\n\n";
cout<<"choise is :";
cin>>x;
while (true)
{
switch (x)
{
case 1:
break;
case 2:
case 3: break;
case 4:
break;
case 5:
case 6:
break;
case 7:return 0;
default:cout<<"This is wrong Chois,,, Try again\n";
break;
}
goto first;
}
} |
| |
December 23rd, 2003, 03:05 PM
|
#3 (permalink)
| | Ultimate Member
Join Date: Jun 2002 Location: Iowa
Posts: 2,879
|
hmmmm looks like a homework project to me  |
| |
December 23rd, 2003, 03:19 PM
|
#4 (permalink)
| | Junior Member
Join Date: Dec 2003
Posts: 5
| |
| |
December 23rd, 2003, 09:37 PM
|
#5 (permalink)
| | Senior Member
Join Date: May 2002 Location: Rocky Mountain High
Posts: 613
|
Hehe, we're not really supposed to do those 
__________________
Talking in numbers doesn't make you smarter.
|
| |
December 23rd, 2003, 09:49 PM
|
#6 (permalink)
| | Leader of the Crab People
Join Date: Oct 2001 Location: NCSU
Posts: 4,381
| Code: #include<stdio.h>
main()
{
printf("I didn't do my homework last night");
printf("\nSo c'mon and give me that big fat F I deserve!");
printf("\nOh, and did I mention my professor is such a moron!);
printf("\nHaha! Stupid professor!");
return 0;
}
Last edited by Redwolf : December 23rd, 2003 at 10:01 PM.
|
| |
December 23rd, 2003, 09:50 PM
|
#7 (permalink)
| | Senior Member
Join Date: May 2002 Location: Rocky Mountain High
Posts: 613
|
First of all...Welcome to TechIMO!!
Here's a few conceptual thoughts to get you started despite our lax little guideline...
--Adding a grade for a student is basically taking a value (cin) and setting it equal to that student's spot in the array (a[0]=x) (each student seems to be represented by and array index 0-5, or six students total).
--Updating is the same process of code.
--Displaying a grade can be a simple cout statement (student [index] has [value] in the class). While displaying the values for all students is the same thing but in some sort of for/while loop running through a number of times equal to the number of students.
--Sorting...there are hundreds of easy ways to do this. The simplest was would be to do some sort of a bubble sort on your array of student grades (look up bubble sort on google to get some code or pseudocode for the algorithm...it's not difficult to figure out).
BTW, goto is not a command recognized in C++, but rather in BASIC and FORTRAN (i think...)
~edit: LOL Redwolf that's not friendly  |
| |
December 23rd, 2003, 10:00 PM
|
#8 (permalink)
| | Leader of the Crab People
Join Date: Oct 2001 Location: NCSU
Posts: 4,381
|
No, but it is fun
I'd help you. but all I know is C  |
| |
December 24th, 2003, 02:51 PM
|
#9 (permalink)
| | Junior Member
Join Date: Dec 2003
Posts: 5
|
thank you for all......
But i really need more help.. |
| |
December 24th, 2003, 04:13 PM
|
#10 (permalink)
| | Junior Member
Join Date: Dec 2003
Posts: 5
|
this is work form 1 to 4 for choise
and No error but Bad work i do not know a reson
void addgrade (int m[student][exams])
{
static int sum =0;
for (int i=0;i<student;i++)
{
cout<<"\n Enter grade for student numbers:"<<sum+1<<endl;
for(int j=0;j<exams;j++)
{
cin>>m[i][j];
}
sum+=1;
break;
}
}
void updategrade (int m[student][exams],int f)
{
m[f][exams];
for (int i=0;i<student;i++)
{
cout<<"\n Enter grade for student numbers:"<<f<<endl;
for(int j=0;j<exams;j++)
{
cin>>m[i][j];
}
break;
}
}
void displayone (int m[][exams],int k)
{
m[k][exams];
for(int j=0;j<exams;j++)
{
cout<<m[k][j]<<endl;
}
}
void displayall(int grade[student][exams])
{
for(int i=0;i<student;i++)
for(int j=0;j<exams;j++)
cout<<grade[i][j];
} |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |