Professional Documents
Culture Documents
Lab #1
Lab #1
Lab #1
At the end of this Lab. you will be able to learn; 1. 2. 3. 4. 5. 6. Header Files Stream Insertion Operator Stream Extraction Operator C++ Statements Assignment Statements Escape Sequences
cout << "Enter first integer\n"; // prompt cin >> integer1; // read an integer
cout << "Enter second integer\n"; // prompt cin >> integer2; // read an integer
sum = integer1 + integer2; // assign result to sum cout << "Sum is " << sum << std::endl; // print sum getch(); // indicate that program ended successfully } // end function main
Lab Practice #3
# include <iostream.h> # include <conio.h> int main() { int grade; cout<<"Name: \"xyz\""; cout<<"\nRoll Number: \"123\""; cout<<"\nsubject: \"C++ programming\""; cout<<"\nenter your grade :"; cin>>grade; if (grade>=90) cout<<"A"; if (grade>=80) cout<<"B"; if (grade>=70) cout<<"C"; if (grade>=60) cout<<"D"; if (grade<60) cout<<"F"; getch(); }