stdcoutBn else ifgrade 70 stdcoutCn else stdcoutFn int grade 0 int num

# Stdcoutbn else ifgrade 70 stdcoutcn else stdcoutfn

This preview shows page 37 - 45 out of 69 pages.

std::cout<<"B\n"; else if(grade >= 70) std::cout<<"C\n"; else std::cout<<"F\n"; int grade = 0; int num; cout<<"enter the number to know your grade "<<endl; cin>>num; if (grade >= 90){ cout<<"A"<<endl; } { else if (grade >= 80) { cout<<"B"<<endl; } else if (grade >= 70){ cout<<"C"<<endl; } else if (grade >= 60){ cout<<"D"<<endl; } else cout<<"F"<<endl; return 0; }*/ /* int a, b; int max; cout<<"Enter two integer a and b "<<endl; cin>>a>>b; max = (a >b)?a:b; cout<<"The largest number is "<<max<<endl;*/
/*int x, y; cout<<"Enter the two numbers "<<std::endl; cin>>x>>y; if (x % y == 0) cout<<x<<" is a multiple of "<<y<<endl; else if (x % y != 0) cout<<x<<"is not multiple "<<endl;*/ /*int x, y, z; int sum = 0 ; int average = 0 ; int product = 0 ; int smallest = 0 ; int largest = 0; cout<<"Enter the three integers "<<std::endl; cin>>x>>y>>z; sum = x + y + z; cout<<"The sume of the three integers is "<<sum<<endl; average = sum / 3; cout<<"The average of the three intgers is "<<average<<endl; product = x * y * z; cout<<"The product of the three integers is "<<product<<endl; x = smallest; if (x < y) cout<<x<<"is the smallest"<<endl; if (y < z ) y = smallest; cout<<y<< "is the smallest "<<endl; int x, y; cout<<"enter the two numbers "<<std::endl; cin>>x>>y; if (x > y ) cout<<x<< " is greater than "<<y<<std::endl; else if (x < y ) cout<<y<<" is greater than "<<x<<std::endl; else if (x == y ) cout<<x<< " is equal to "<<y<<std::endl;*/
/*int num1; int num2; int sum = 0; int Product = 0; int quotient = 0; cout<<"Enter two numbers"<<std::endl; cin>>num1; cin>>num2; sum = num1+num2; cout<<"The sume of the two number is "<<sum<<std::endl; Product = num1 * num2; cout<<"The product of the two numbers is "<<Product<<std::endl; quotient= num1 / num2 ; cout<<"The quoitent of the two numbers is " <<quotient<<std::endl;*/ /* int number; std::cout<<"Enter a 5-digit integers "; std::cin>>number; std::cout<<number/10000<<","; std::cout<<number /1000 - number/10000 * 10 <<","; std::cout<<number /100 - number/1000 * 10 << ","; std::cout<<number/10 - number/100 * 10 <<","; std::cout<<number-number/10 * 10 <<"\n"; return 0; }*/
/*int number = 25; int r; r = 25/10; std::cout<<r<<","; std::cout<<number - r * 10 <<std::endl; */ /*int number; int square; int cube; cout<<"Integer\tSquare\tCube"<<std::endl; number = 1; square = number * number ; cube = number * number * number; cout<<number<<"\t"<<square<<"\t"<<cube<<std::endl; number = 2; square = number * number ; cube = number * number * number; cout<<number<<"\t"<<square<<"\t"<<cube<<std::endl;*/
/*#include <iostream> using namespace std; main () { for (int i =1; i<5; i++) { for (int j = 1; j<=0 ; j++) { if (i <= j ) && ( j <=10-i ) cout<<'x'; else cout<<' '; } cout<<endl; } return 0 ; */ /*#include<iostream> #include<time.h> using namespace std; int main() { srand(time(NULL));
int random = (rand()%9) + 1; int count = 0 ; int in; while(count != 3) { cout<<"What is the random number I guessed? :"; cin>>in; if(random - in == 1 || random-in == -1) { cout<<"Close!"; } else if(in < random) { cout<<"Too low!"; } else if (in > random) { cout<<"too high!"; } else { cout<<"Correct!"; cout<<"\n\n"; return 0; } cout<<"\n"; count++; } cout<<"You loose, the number was "<<random<<"!"; cout<<"\n\n"; return 0; }*/
/* #include <iostream> using namespace std; double diam(double r) { double d; d = 2 * r; return d; } double circ(double r) { double c; c = 2 * 3.1416 * r; return c; } double area(double r) { double a; a = 3.1416 * r * r; return a; } int main() { double r; cout << "Enter the radius of the circle: "; cin >> r; cout << "The diameter is " << diam(r) << endl; cout << "The circumference is " << circ(r) << endl; cout << "The area is " << area(r) << endl; return 0; }*/
/*#include <iostream> using namespace std; int fun(int a ) { int b = a*2; return b; } int main () { int y = 3 ; cout<<fun(y) <<endl; cout<<fun(y++); return 0 ; }*/ /*double PI = 3.14159; double sphereVolume (const double radius) { return 4.0/3.0 * PI * radius * radius * radius;

#### You've reached the end of your free preview.

Want to read all 69 pages?

• Spring '18
• Shaobai Kan
• Summation, namespace std