Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Cs
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include <iostream> #include <string.h> using namespace std; // Amjad Alqarni, shrooq Alharbi, Hanan Bolaqi //Group 2 double avg(double sum, int n){ double avg=sum/n; return avg; } int main() { int n,m, s,i=1,t=0,k=0; cout<<"Enter the size of student array"<<endl; cin>>n; cout<<"Enter the size of course array"<<endl; cin>>s; string name [n]; int course [s]; int grade [n][s]; for (int r=0 ; r<n; ++r) { cout<<"enter name of student #"<<r+1<<" "<<endl; cin>>name[r]; } for ( t=0; t<n ;++t) for(k=0;k<s;++k) { cout<<"enter grade of "<<name [t]<<" for course #"<<k+1<<" "<<endl; cin>>grade [t][k]; } do { cout<<"enter the number of your choose from the Menu: "; cout<<"\n1. Add a student’s grade in a course."; cout<<"\n2. Print grades for a certain course and the average of students’ grades in this course. "; cout<<"\n3. Print the grade letter for all courses of a certain student. "; cout<<"\n4. Update the grade of a student in a certain grade. "; cout<<"\n5. Delete a certain mark for certain student "; cout<<"\n6. Exit"<<endl; cin>>m; switch(m) { case 1: break; case 2: { int i=0; double sum=0.0; cout<<"Enter the index for the certain course"<<endl; cin>>i; cout<<"Grades in this course"<<endl; for(int r=0; r<n; r++) { sum+=grade [r][i]; cout<<grade[r][i]; cout<<endl; } cout<<"The avrage is "; cout <<avg(sum, n)<<endl; break; } case 3: { int i,sums=0.0; double avrg; //. Print the grade letter for all courses of a certain student. cout<<"Enter the index for the certain student "<<endl; cin>>i; for(int x=0;x<s;x++) { sums+=grade[i][x]; } avrg=sums/s; if (avrg>=90) cout<<"the grade letter"<<" "<<"A"<<endl; else if (avrg>=80) cout<<"the grade letter"<<" "<<"B"<<endl; else if(avrg>=70) cout<<"the grade letter"<<" "<<"C"<<endl; else if (avrg>=60) cout<<"the grade letter"<<" "<<"D"<<endl; else cout<<"the grade letter"<<" "<<"F"<<endl; break; } case 4: break; case 5: break; case 6 : break; } }while(m!=6); }
Show compiler warnings
[
+
]
Show input
fork mode
|
history
|
discussion