Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
0Activity
0 of .
Results for:
No results containing your search query
P. 1
Ce 204 for Practice

Ce 204 for Practice

Ratings: (0)|Views: 6 |Likes:
Published by Sa'ad Abd Ar Rafie

More info:

Published by: Sa'ad Abd Ar Rafie on Jul 05, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

07/05/2012

pdf

text

original

 
1CE 204: HOMEWORK
Md. Ferdous Alam, Lecturer, Dept. of CE, BUET, Dhaka-1000.
 Note: Some programs are erroneous. Students should find those errors and understand.
 
#include<iostream.h>void main (){double number,credit,GPA;double sum=0,sum_2=0;char answer;input_number:cout<<"Number= ";cin>>number;if(number<0 || number>100){cout<<"Invalid number input\n";goto input_number;}input_credit:cout<<"Credit= ";cin>>credit;if(credit<=0 || credit>4){cout<<"Invalid credit input\n";goto input_credit;}if(number<40 && number>=0) credit=0;else credit=credit;if(number<=100 && number>=80) sum+=4.0*credit;
 
2
else if(number<80 && number>=75) sum+=3.75*credit;else if(number<75 && number>=70) sum+=3.5*credit;else if(number<70 && number>=65) sum+=3.25*credit;else if(number<65 && number>=60) sum+=3.0*credit;else if(number<60 && number>=55) sum+=2.75*credit;else if(number<55 && number>=50) sum+=2.5*credit;else if(number<50 && number>=45) sum+=2.25*credit;else if(number<45 && number>=40) sum+=2.0*credit;else sum+=0*credit;sum_2+=credit;subject:cout<<"Any more subject? (y/n)= "; cin>>answer;if(answer=='y' || answer=='Y') goto input_number;else if(answer=='n' || answer=='N') goto final;else{cout<<"(y/n)???????\n";goto subject;}final:GPA=sum/sum_2;cout<<"\n\nYour GPA is= "<<GPA<<endl<<endl;}
 
#include<iostream.h>int a=20;void main (){
 
3
cout<<a<<endl;int a=50;{int a=100;{int a=80;}cout<<a<<endl;}cout<<a<<endl;}
 
#include<iostream>using namespace std;char main (){const int a=60;cin>>a;cout<<a<<endl;return 0;}
 
#include<iostream.h>void main (){int a=b=10;cout<<a<<"\t"<<b<<endl;}

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->