alfps

Untitled

Apr 20th, 2021
567
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6.     // variables declaration
  7.     int x=92,y=7;
  8.     string s="Programming is fun";
  9.     char w='X';
  10.     double a = 2.9999925;
  11.     float b = 2.334f;
  12.     int i;      // This variable is not used so may get a warning.
  13.     cout<<"The sum of two numbers is "<<x+y<<endl;
  14.     cout<<"The difference of two numbers is "<<x-y<<endl;
  15.     cout<<"The quotient of two numbers is "<<x/y<<endl;
  16.     cout<<"The product of two numbers is "<<x*y<<endl;
  17.     cout<<w<<w<<w<<s<<w<<w<<w;
  18.    
  19.     //conditional statement < > <= >= <> != relational operators
  20.     // boolean operators && (and) || (or) !(not)
  21.     if (!(a>b || x<y)) { // true || false = true
  22.         cout<<a<<" is greater than "<<b<<"."<<endl;
  23.         cout<<"This is the second statement."<<endl;
  24.     }
  25.     else
  26.         cout<<"Am here."<<endl;
  27.     cout<<"Am here too."<<endl;
  28.    
  29.     //Looping
  30.     for (int counter=1; counter<=10; counter+=2) {
  31.         cout<<counter<<endl;
  32.     }
  33.     cout<<"end of loop"<<endl;
  34. }
  35.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×