31-12-2010, 09:48 PM
|
#1003
|
تاريخ التسجيل: Jul 2008
كلية: كلية الحاسبات وتقنية المعلومات
التخصص: IT
نوع الدراسة: عضو هيئة تدريس
المستوى: متخرج
البلد: جــــدة
الجنس: ذكر
المشاركات: 2,477
|
رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد
Write a program that reads numbers of students(max 30), then store the student ID (serial numbers start from 1, you must fill it) ,and read from user: mid exam and final exam marks all store in arrays such as:
1
2
3
4
5
6
40
30
40
39
10
15
60
30
39
20
48
44
No. of employee = 6
id mid(max40) final(max 60)
100
60
79
59
58
59
2. And then create another array to store total marks for each student(you will fill it total=mid+final)
100
60
79
60
60
60
3. check if some students get 57,58,59, modify it to 60.
4. Print id and total arrays after modify like bellow example:
5. Using the following functions implement the program:
· Void get_data(int i[],int m[], int f[],int t[],nt no);
//no=length of the arrays
// to fill Id and total, read mid and final from the user .
· Void check_total( int t[],int no);
//to check if the total =57 or 58 or 59, then total =60
· Void display(int i[], int t[],int no);
// print id and total values .
Output:
How many student you have:6
Enter mid and final for s1:40 60
Enter mid and final for s2:30 30
Enter mid and final for s3:40 39
Enter mid and final for s4:39 20
Enter mid and final for s5:10 48
Enter mid and final for s6 44
ID
total
1
100
2
60
3
79
4
60
5
60
6
60
مستر احمد عارفه اني ططفشتك
التسليم يوم السبت و احتاج احله بلييييييز
|
كود PHP:
#include<stdio.h> #include<conio.h>
void get_data(int i[],int m[], int f[],int t[],int no) { int k; for (k = 0; k < no; k++) { printf("Enter mid and final for s%d : ", i[k]); scanf("%d %d", &m[k], &f[k]); t[k] = m[k] + f[k]; } } void check_total( int t[],int no) { int i; for (i = 0; i < no; i++) { if (t[i] == 57 || t[i] == 58 || t[i] == 59) { t[i] = 60; } } } void display(int i[], int t[],int no) { int k; printf("Total :\n"); for (k = 0; k < no; k++) { printf("ID s%d : %d \n",i[k], t[k]); } } int main () { int i,size,id[30], mid[30], final[30], total[30]; printf("How many student you have : "); scanf("%d",&size); //Set ID Number for (i = 0; i < size; i++) id[i] = i + 1; //call Function get_data get_data(id, mid, final, total,size); //call Function check_total check_total(total, size); //call Function display display(id,total,size); getch(); return 0; }
|
|
سبحان الله وبحمد ,,, سبحان الله العظيم الحمد لله كما ينبغي لجلال وجهه وعظيم سلطانه . اللهم صل على محمد وعلى آل محمد كما صليت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد . اللهم بارك على محمد وعلى آل محمد كما باركت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد.
|
|
|
|