2. Write a program to calculate CGPA of a student. The program should be able to get input from the user of the grade for each course. Use data in Table 1 and Table 2 as to calculate the CGPA. Course Credit Hour Mathematics 5 Physics 5 Chemistry 5 Computer 5 BEL 3 CTU 2 Table 1: Course Information Grade Point A 4.00 B 3.00 C 2.00 Table 2: Grade Information
U wanna solve it in which language c, c++, java ,python?? Kindly specify
C
C or C++
ohk. . :)
ok , I'm waiting . . . . . . .
we have to get the input as grade from the user for each course example mathematics, physics etc.?? Is it necessary to get input for each course?? well i mean to say the user maight not be taking all the courses. . or do we have to take input for all the courses?? secondly what does credit hour stands for?? How do we hv to use in the programme??
yes , we have to take input for all the courses Mathematics 4 Physics 4 Chemistry 4 Computer 3 BEL 3 Total 18 credit hour stands
90 to 100 = A 80 to 89 = B 70 to 79 = c 60 to 69 = D lessthen 60 = F
Since we dont have CGPA system in my country?? What is the formula to calculate it ??
Total grage divided by total credit hour
ohk so wht we will be doing here is to get the input as Grade from the user for each course and then finding out the total sum of the points. . and then divide it by the total sum of respective credit hour?? do i sound correct??
yes , extly right
ohk wait. . m trying :)
ok
For Example : Mathematics = ( Gradre poin 2 ) ( Grade Hours 3 ) that means grade poin 2*3 = 6 Physics ( Gradre poin 3 ) ( Grade Hours 3 ) that means grade poin 3*3 = 9 Chemistry ( Gradre poin 2 ) ( Grade Hours 3 ) that means grade poin 2*3 = 6 here Total credit Hours 3+3+3 = 9 and Grade poin 6+9+6=21 So CGPA = 21/9
21/9 = 2.333
ohhh mistak not gradre hours its credit hours
ohk but credit hours are given to us for each course they r predefined. . we dont have to get them as input frm the user??
yes , credit hour is fixed , user can't input credit hours
ohk :)
For Mathematics 3 credit hours Physics 3 Chemistry 3 Computer 3 BEL 3 Fixed
but in the question u said Course Credit Hour Mathematics 5 Physics 5 Chemistry 5 Computer 5 BEL 3 CTU 2 Table 1: Course Information
ok do anyone , thats not problem after solv the problem then i can edit it
ohk
i need just the formate of the programe
ohk wait. . I will be doing it for maths and physics. . u will get the idea how to do the rest:)
ohkkkk ,
#include<stdio.h> #include<conio.h> void main() { int a=0, b=0; float cgpa; char m,bel,; printf("Enter the grade obtained in Mathematics"); scanf("%c",&m); if(m=='A')||(m=='a) a=(a+4)*5 if(m=='B')||(m=='b') a=(a+3)*5 if(m=='C')||(m=='c') a=(a+2)*5 b=b+5 printf("Enter the grade obtained in BEL"); scanf("%c",&bel); if(bel=='A')||(bel=='a) a=(a+4)*3 if(bel=='B')||(bel=='b') a=(a+3)*3 if(bel=='C')||(bel=='c') a=(a+2)*3 b=b+3 cgpa=a/b printf("The cgpa=%f",cgpa) } To make it clear. . i have used for BEL instead of physics . . coz it's credit hour is 3. . differnt frm physics n maths :p
okkk :) , w8 im cheking
I havnt checked in the turbo c compiler. . so it may be having some syntax errors. .
ok
check it . n lemme knw :)
oww , its working , many many tnx for your help :)
np. . my pleasure :)
see you next time now bye
biee. . . u can contact me if u encounter further problem mail id is mallika454@gmail.com
ok tnx
hey boss , whats up?
Nothing much :) N u ??
i'm fine , but i hav a new problem :p
#include<stdio.h> void main() { struct srecord { int r; char n[50]; float m; } s1[4]; for(int i=0;i<=2;i++) { cout<<"Please enter Student ("<<i+1<<")\n\t"; cout<<"Roll:"; cin>>s1[i].r; cout<<"\tName:"; cin>>s1[i].n; cout<<"\tMarks:"; cin>>s1[i].m; } cout<<endl; for(int i=0;i<=2;i++) { cout<<"Student ("<<i+1<<")\n\t"; cout<<"Roll:"<<s1[i].r; cout<<"\n\tName:"<<s1[i].n; cout<<"\n\tMarks:"<<s1[i].m; cout<<endl; } cout<<endl; }
where ??
its not working i can't find out the mistak
put up the code here
#include<stdio.h> void main() { struct srecord { int r; char n[50]; float m; } s1[4]; for(int i=0;i<=2;i++) { cout<<"Please enter Student ("<<i+1<<")\n\t"; cout<<"Roll:"; cin>>s1[i].r; cout<<"\tName:"; cin>>s1[i].n; cout<<"\tMarks:"; cin>>s1[i].m; } cout<<endl; for(int i=0;i<=2;i++) { cout<<"Student ("<<i+1<<")\n\t"; cout<<"Roll:"<<s1[i].r; cout<<"\n\tName:"<<s1[i].n; cout<<"\n\tMarks:"<<s1[i].m; cout<<endl; } cout<<endl; }
what r u trying to do here in this programme ??
make a Student list with roll , name and mark and roll , name , mark input from user
nop im not Zeeshan Nasir , im Mamun
please chek it
ohk
at the end use getch() maybe that helps out and also use #include<conio.h> after stdio.h
ok , im trying
ya lemme knw
same error :'(
ohk wait
ok
Ahaan. . u r doing it in c++. . so u need to define header file <iostream.h>. . standard input output and not <stdio,h> (that's for c) Moreover the code that u hv pasted is in c++ whereas the tyj.pnj is in c. . Mate. . first make it clear in which language u wanna make uar programme becoz uar logic is correct. . just the syntax prob CHEERS
First i need c not c++ that means tyj.pnj
then paste the code in c. . and not c++ plz
ok
#include <stdio.h> void main() { struct info { int roll; char name[30]; float marks; }student[5]; int i; printf("Plz Enter the name,roll & marks of the students 1 by 1."); for(i=0;i<5;i++) { scanf("%s %d %f",student[i].name,&student[i].roll,&student[i].marks); } printf("\n\n\tName \tRoll \tMarks"); for(i=0;i<5;i++) { printf("\n%d \t%s \t%d \t%f",i+1,student[i].name,student[i].roll,student[i].marks); } }
ERROR IN for(i=0;i<5;i++) { scanf("%s %d %f",student[i].name,&student[i].roll,&student[i].marks); } IT SHOULD BE scanf("%s %d %f",&student[i].name u missed that &
ok wait please , cheking
Oppss! nop , same error
also it should be %c and not %s
ok , today im trying if i can't solv it then tomorw again i call you , now bye Take cate Good Night
give me uar mail. . i will mail u
jahidalmamun@yahoo.com
alrt. . I will mail u. . Gudnyt is the word :)
ok , Good Night u tooo
:)
#include<stdio.h> #include<conio.h> #include<string.h> struct student { char name[25]; int roll; int marks[3]; }; void main() { int i,n; struct student st[40]; clrscr(); printf("Enter how many students: "); scanf("%d",&n); /* for loop to read the names and roll numbers and marks obtained*/ for(i=0;i<n;i++) { printf("\nEnter name for student %d : ",i+1); scanf("%s",&st[i].name); printf("\nEnter rollnumber for student %d : ",i+1); scanf("%d",&st[i].roll); printf("\nEnter marks for student %d : ",i+1); scanf("%f",&st[i].marks); } /* for loop to print the names and roll numbers and marks obtained*/ for(i=0;i<n;i++) { printf("\n The name of student %d :%s ",i+1,st[i].name); printf("\n The name of student %d :%d ",i+1,st[i].roll); printf("\n The name of student %d :%f",i+1,st[i].marks); } getch(); } Check it out
Thank You for your reply but there have an error :'(
I dont knw which compiler u are using. . so since it is showing error with clrscr() try to remove that. . maybe it works .... I usually use turbo c compiler
ok , im trying
Yup
ha ha ha ha , Thank you now its working , Thank you
Oh m glad. . finally. . uar welcome :) by the way which compiler r u using ??
Code Block
ohk
codeblocks-10.05mingw-setup
oh. . I usually use dev c++ or turbo c . . turbo c is the best. .
yap turbo c is best i know but code block is stylish :D
he he. . Amazing. . which country r u frm ??
Bangladesh
u pakistan?
No. . who said?? m frm India. .
owww
Neighbours :)
yap
tumara nam moli ho , :D
u knw Hindi :p ??
it's my pet name
kuch kuch
ohk :)
mera ek brother live in india permanatly from childhd
Join our real-time social learning platform and learn together with your friends!