lab 3.docx - Lab 03 Programming in C Objectives To make programs using different statements of C and understanding control structures loops etc Tools

lab 3.docx - Lab 03 Programming in C Objectives To make...

This preview shows page 1 - 8 out of 25 pages.

Lab # 03: Programming in C++ Objectives: To make programs using different statements of C++ and understanding control structures loops etc.. Tools Used: Computer MS visual studio. Submission Date: 3-03-16 Evaluation: Signatures of Lab Engineer:
Image of page 1
Task # 3.1: Procedure/Program: #include<iostream> #include<conio.h> using namespace std; int main() { int a=5, b=10; cout<< (a>b)<<endl; cout<< (a<b)<<endl; cout<<(a==b)<<endl; cout<<(a!=b)<<endl; system("pause"); return 0; } Result/Output: Analysis/Conclusion:
Image of page 2
Task # 3.2: Procedure/Program: #include<iostream> #include<conio.h> using namespace std; int main() { int a=5, b=10, c=15; cout << ((a > b) && (c > b)) << endl; cout << ((a > b) || (c > b))<< endl; cout << (a || b) << endl; cout << (a && b) << endl; cout << !(a > b) << endl; system("pause"); return 0; } Result/Output: Analysis/Conclusion:
Image of page 3
Task # 3.3: Procedure/Program: #include<iostream> #include<conio.h> using namespace std; int main() { int x; cout<<"enter a number"; cin>> x; if ( x > 10 ) cout<<"The number is greater than 10"<<endl; cout<<"Program Continues"; system("pause"); return 0; } Result/Output: Analysis/Conclusion:
Image of page 4
Task # 3.4: Procedure/Program: #include<iostream> #include<conio.h> using namespace std; int main() { int x; cout<<"Enter a number:"; cin>> x; if ( x > 10 ) cout<<"The number is greater than 10"<<endl; else cout<<"The number is less than or equal to 10"; cout<<"Program Continues"; system("pause"); return 0; } Result/Output: Analysis/Conclusion:
Image of page 5
Task # 3.5: Procedure/Program: #include<iostream> #include<conio.h> using namespace std; int main() { int x; cout<<"Enter a number"; cin>> x; if ( x > 10 ) cout<<"The number is greater than 10"<<endl; else { cout<<"The number is less than 10"<<endl; cout<<"The number may also be equal to 10"<<endl; } cout<<"Program Continues"<<endl; system("pause"); return 0; } Result/Output: Analysis/Conclusion:
Image of page 6
Task # 3.6: Procedure/Program: #include<iostream> #include<conio.h> using namespace std; int main() { char grade; cout<<"enter grade:"<<endl; cin>>grade;
Image of page 7
Image of page 8

You've reached the end of your free preview.

Want to read all 25 pages?

  • Spring '16
  • Negative and non-negative numbers, Plus and minus signs, cout

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture