sourcecode

 #include <iostream>

#include <vector>

#include <iomanip>

#include <cmath>

using namespace std;

int main() {

//    int favorite_number;

//    cout<< "Enter your favourite number b/w 1 and 100:- ";

//

//    cin >> favorite_number;

//    cout << "Nice thats my favorite number too! " << endl;

//    cout << "No really "<< favorite_number<<" is my favorite number "<< endl;

//    return 0;

//      int room_width{0};

//      int room_length{0};

//      cin >> room_width;

//

//      cout << "Enter the width ";

//

//      

//      cout << "Enter the length " ;

//      cin >> room_length;

//      cout << "The area of the room is " << room_length * room_width << endl;

//      return 0;

////cout << "char " << sizeof(char) << " bytes "<< endl;

//return 0;

//int number_of_largerooms{0};

//int number_of_smallrooms{0};

//cout << "Enter the number of large rooms you would like to be cleaned :- ";

//cin >> number_of_largerooms;

//cout << "Enter the number of small  rooms you would like to be cleaned :- ";

//cin >> number_of_smallrooms;

//

//cout << "The number of rooms is : " << number_of_largerooms + number_of_smallrooms <<endl;

//

//cout << "The price for 1 room is $90"<<endl;

//cout << "Sales Tax is 6%"<<endl;

//int price_per_room{90};

//double tax{0.06};

//int cost(price_per_room * (number_of_largerooms + number_of_smallrooms));

//double total_tax(price_per_room * tax * (number_of_largerooms + number_of_smallrooms));

//cout << "Your cleaning cost will be "<<cost<<endl;

//cout << "The amount of tax will be "<< total_tax<< endl;

//cout << "Your total estimate will be " << cost + total_tax << endl;

//cout << "==================================" << endl;

//cout << "This estimate will be valid for the next 40 days" << endl;

//

//return 0;

//int input;

//double the_result;

//cout << "Enter any number ";

//cin >> input;

//the_result = sqrt(input);

//cout << "the square root of " << input << " is " << the_result<< endl;

//vector <int> test_scores {50,60};

//cout <<"Enter 2 test scores separated by a space -" ;

//cin >> test_scores.at(0);

//cin >> test_scores.at(1);

//cout << "the updated test scores"<< endl;

//cout << test_scores.at(0)<<endl;

//cout << test_scores.at(1)<<endl;


//vector <int> vector1 ;

//vector <int> vector2 ;

//vector1.push_back(10);

//vector1.push_back(20);

//cout << vector1.at(0)<<endl;

//cout << vector1.at(1)<<endl;

//cout << vector1.size()<<endl;

//

//

//

//vector2.push_back(100);

//vector1.push_back(200);

//cout << vector2.at(0)<<endl;

//cout << vector2.at(1)<<endl;

//cout << vector2.size()<<endl;

//

//vector1.at(0)= 1000;



//int num1{100};

//int num2{200};

//int result{0};

//result = num1 + num2;

//cout << "the sum of "<< num1 << "and" << num2 << "is"f << result<< endl;


//const  double usdollar_per_eur{1.19};

//double dollar{0.0};

//double euro{0.0};

//

//cout << "Welcome to the euro to dollar converter " <<endl;

//cout << "Enter the value in eur";

//cin>> euro;

//dollar = euro * usdollar_per_eur;

//cout << euro << "Euro is equivalent to " << dollar << " dollars"<<endl;

//

//return 0;

// MILES TO KILOMETER CONVERTER 


//const double milesin_one_kilometer{1.6};

//double km{0.0};

//int miles{0};

//cout << "Welcome to the kilometeres into miles converter" << endl;

//cout << "Enter the number of miles sir :- ";

//cin >>miles;

//km = miles * milesin_one_kilometer;

//cout << miles<< " miles" << " is equivalent to " << km << " km"<<endl;  



//int total{};

//int num1{},num2{},num3{};

//const int count{3};

//cout << "Enter three integer separated by a space " ;

//cin>>num1>>num2>>num3;

//total = num1 + num2 + num3;

//double average {0.0};

//average = static_cast<double>(total) / count;

//cout << "The average of the numbers you've entered is " << average<<endl;


//cout << boolalpha;

//int num1{};

//int lower{10};

//int upper{};

//cout << "Enter an integer that is greater than 10";

//cin > upper;

//const int dollars_onecent{100};

//const int nickels_onecent{5};

//const int quarter_onecent{25};

//const int dime_onecent{10};

//int pennies{};

//int dollars{};

//int quaters{};

//int cents_entered{};

//int balance{};

//int dimes{};

//int nickels{};

//balance = dollars = quaters = pennies = dimes = nickels = 0;

//cout << "Enter the number in cents sir/mam: ";

//cin >> cents_entered;

//dollars = cents_entered / dollars_onecent;

//balance = cents_entered % dollars_onecent;

//

//quaters = balance / quarter_onecent;

//balance %= quarter_onecent;

//

//dimes = balance / dime_onecent;

//balance %= dime_onecent;

//

//nickels = balance / nickels_onecent;

//balance %= nickels_onecent;

//

//pennies = balance;

//cout << "You can apply this change as follows:- "<<endl;

//cout << "dollars: "<< dollars<<endl;

//cout << "quarters: "<<quaters <<endl;

//cout << "dimes: "<< dimes<<endl;

//cout << "nickels: "<< nickels<<endl;

//cout << "pennies: " << pennies <<endl;


//const int dollars_onecent{100};

//const int nickels_onecent{5};

//const int quarter_onecent{25};

//const int dime_onecent{10};

//int pennies{};

//int dollars{};

//int quaters{};

//int cents_entered{};

//int balance{};

//int dimes{};

//int nickels{};

//balance = dollars = quaters = pennies = dimes = nickels = 0;

//cout << "Enter the amount in cents ";

//cin >> cents_entered;

//dollars = cents_entered / dollars_onecent;

//balance = cents_entered % dollars_onecent;

//

//quaters = balance / quarter_onecent;

//balance %= quarter_onecent;

//

//dimes = balance / dime_onecent;

//balance %= dime_onecent;

//

//nickels = balance / nickels_onecent;

//balance %= nickels_onecent;

//pennies = balance;

//cout << "You can provide this change as follows :" << endl;

//cout << "dollars: " << dollars;

//cout << "quarters: " << quaters;

//cout << "dimes: " << dimes;

//cout << "nickels: " << nickels;

//cout << "pennies: " << pennies;

//int num{0};

//const int min{10};

//const int max{100};

//cout << "Enter a number " << min << " and " << max << ": ";

//cin>> num;

//if (num >= min){

//    cout << "\n======statement 1=================="<<endl;

//    cout << num << " is greater than " << min<<endl;

//    int diff{num - min};

//    cout << num<< "is" << diff << " greater than" << min <<endl;

//}

//if (num <= 100){

//    cout << "\n======statement 2==================" << endl;

//    cout << num << " num is less than" << max << endl;

//

//    int diff{max - num};

//    cout << num << " is " << diff << " less than " << max<<endl; 

//}

//if (num >= 10 && num <= 100){

//    cout << "\n============if statement 3 ===============" << endl;

//    cout << num << " is in range" << endl;

//}

//if (num == min || num == max){

//    cout << "\n============if statement 4 =========" << endl;

//    cout << num << " is right on the boundary"<<endl;

//    

//}

//int score{};

//cout << "Enter your score in exam (0 - 100): ";

//cin >> score;

//char letter_grade{}; 

//if (score >= 0 && score <=100){

//    if (score > 90)

//        letter_grade = 'A';

//    else if (score > 80)

//        letter_grade = 'B';

//    else if (score > 80)

//        letter_grade = 'B';

//    else if (score > 70)

//        letter_grade = 'C';

//    else if (score > 60)

//        letter_grade = 'D';

//    else

//        letter_grade = 'F';

//        cout << "Your grade is " << letter_grade<<endl;

//        if (letter_grade == 'F')

//            cout << "You need to study !"<< endl;

//        else

//            cout << "CONGRATS! you passed"<<endl;

//

//}

//else {

//    cout << "Sorry " << score << " is out of range"<<endl;

//}

//int package_length{};

//int package_breadth{};

//int package_height{};

//int package_volume{};

//int max_dimension_length{10};

//double base_cost{2.5};

//int tier2_threshold{500};

//int tier1_threshold{100};

//double tier1_surcharge{0.10};

//double tier2_surcharge{0.25};

//

//

//cout << "Welcome to the package cost calculator"<<endl;

//cout << "Enter the package's length, breadth and height in inches separated by a space: ";

//cin >> package_length >> package_breadth >> package_height;

//package_volume = package_breadth * package_height * package_length;

//if (package_length > max_dimension_length ||package_breadth > max_dimension_length || package_height >  max_dimension_length) {

//   cout << "Sorry package rejected " << endl; 

//}

//else{

//    double package_cost{};

//    package_cost = base_cost

//    if(package_volume> tier2_threshold){

//        package_cost += package_cost * tier2_surcharge;

//        cout << "Adding tier 2 surcharge" << endl;

//    }   else if(package_volume > tier1_threshold){

//        package_cost += package_cost * tier1_surcharge;

//        cout << "Adding tier 1 surcharge" << endl;

//            

//        }

//    cout << "The Volume of your package is " << package_volume << endl;

//    cout << "Your package will cost $" << package_cost << "to ship" << endl;    

//

//}

//char letter_grade{};

//cout << "Enter the letter grade you expect on the exam";

//cin >> letter_grade;

//switch (letter_grade){

//    case 'a':

//    case 'A':

//        cout << "YOU NEED A 90 OR ABOVE STUDY HARD !"<<endl;

//        break;

//    case 'b':

//    case 'B':

//        cout << "YOU NEED A 80 OR ABOVE STUDY HARD !"<<endl;

//        break;

//    case 'c':

//    case 'C':

//        cout << "YOU NEED A 70 OR ABOVE STUDY!"<<endl;

//        break;

//    case 'd':

//    case 'D':

//        cout << "YOU NEED A 60 OR ABOVE START MEMORISING AND PRACTICING!"<<endl;

//        break;

//    case 'f':

//    case 'F':

//    {

//        char confirm{};

//        cout << "Are you sure (Y/N)?";

//        cin >> confirm;

//        if (confirm == 'Y' || confirm =='y' )

//            cout << "OK, I guess you didn't study"<<endl;

//        else if(confirm == 'N' || confirm == 'n')

//            cout << "Good , go and study!"<<endl;

//        else

//            cout << "I do NOT know what you've typed "<<endl;

//        break;

//        

//    }

//    default:

//        cout << "INVALID LETTER GRADE ENTERED" <<endl;

//        

//        

//}

//enum Direction{

//    left,right,up,down

//};

//Direction heading{left};

//switch (heading) {

//    case left:

//        cout << "Going left" << endl;

//    break;

//    case right:

//        cout << "Going right" << endl;

//    break;

//    case up:

//        cout << "Going up" << endl;

//    break;

//    case down:

//        cout << "Going down" << endl;

//    break;    

//    default:

//        cout << "I do NOT know what you've typed"<< endl;

//    

//}

//cout << "Welcome to excercise my firend"<<endl;


//int num1{};

//int num2{};

//cout << "Enter number one sir/mam: ";

//cin >> num1;

//cout << "Enter number two sir/mam: ";

//cin >> num2;

//cout << "The sum of the two number you've entered is " << num1 + num2 << endl;


//cout<< "Size of fundamental data types"<<endl;

//

//cout << "The sizeof(char) is " << sizeof(char)<< " bytes"<<endl;

//

//cout << "The sizeof(short) is " << sizeof(short)<< " bytes"<<endl;

//

//cout << "The sizeof(int) is " << sizeof(int)<< " bytes"<<endl;

//

//cout << "The sizeof(long) is " << sizeof(long)<< " bytes"<<endl;

//

//cout << "The sizeof(long long) is " << sizeof(long long)<< " bytes"<<endl;

//

//cout << "The sizeof(float) is " << sizeof(float)<< " bytes"<<endl;

//

//cout << "The sizeof(double) is " << sizeof(double)<< " bytes"<<endl;

//

//cout << "The sizeof(long double) is " << sizeof(long double)<< " bytes"<<endl;

//

//cout << "The sizeof(bool) is " << sizeof(bool)<< " bytes"<<endl;


//int num1{};

//int num2{};

//cout << "Enter number one: ";

//cin >> num1;

//cout << "Enter number two: ";

//cin >> num2;

//cout << "The sum of the two number you've entered is " << num1 + num2 << endl;


//cout << "The sum of the two number you've entered is " << num1 + num2 << endl;

//

//cout<< "Display arithmetic operations with mixed type : "<<endl;

//double num1{};

//double num2{};

//char operater{};

//cout << "Enter num1: ";

//cin >> num1;

//cout << "Enter the operator: ";

//cin >> operater;

//cout << "Enter num2: ";

//cin >> num2;

//if (operater == '+')

//    cout << "The sum of the numbers you've entered is " << num1 + num2<<endl;

//    else if (operater == '-')

//        cout << "The difference of the two numbers you've entered is " << num1 - num2<<endl;

//    else if (operater == '*')

//        cout << "The multiplication of the two numbers you've entered is " << num1 * num2<<endl;

//    else if (operater == '/')

//        cout << "The division of the two numbers you've entered is " << num1 / num2<<endl;

//else{

//    cout << "Invalid operator"<<endl;

//}

//            

//

//  

//int num1{};

//int num{};

//cout << "Display the operation of pre and post increment and decrement: " << endl;

//cout << "Enther the number sir: ";

//cin >> num1;

//cout << "The number is " << num1<<endl;

//

//num = ++num1;

//cout << "After post increment by 1 the number is : " <<num<<endl;

//

//num = ++num1;

//cout << "After pre increment by 1 the number is : " <<num<<endl;

//

//num = ++num1;

//cout << "After increasing by 1 the number is : " <<num<<endl;

//

//num = --num1;

//cout << "After post decrement by 1 the number is : " <<num<<endl;

//

//num = --num1;

//cout << "After pre decrement by 1 the number is : " <<num<<endl;

//

//num = --num1;

//cout << "After decreasing by 1 the number is : " <<num<<endl;

//

//cout << "Formatting the output: "<<endl;

//

//double pi = 3.14159265;

//cout << "The value of pi is: " << pi <<endl;

//

//cout << "The value of pi 4 decimal place of total width 8 : | "<<setw(8)<< pi <<" |"<<endl;

//cout << "The value of pi 4 decimal place of total width 10 : | "<<setw(10)<< pi <<" |"<<endl;

//

//cout << setfill('-');

//cout << "The value of pi 4 decimal place of total width 8 : |"<<setw(8)<< pi <<"|"<<endl;

//cout << "The value of pi 4 decimal place of total width 10 : | "<<setw(10)<< pi <<" |"<<endl;

//

//cout << scientific;

//cout << "The value of pi in scientific format is: " <<pi<<endl;

//

//cout << "Print the result of some specific operation: "<<endl;

//

//cout << "Result of 1st epression: " << 1 + 2 * 6 <<endl;

//

//cout << "Result of 2nd epression: " << 987 + 66 * 6 <<endl;

//

//cout << "Result of 3rd epression: " << 2 +9 % 6<<endl;

//

//cout << "Result of 4th epression: " << 78 + 32 * 28/38 <<endl;

//



//int num1{};

//int num2{};

//cout << "Sum of two numbers"<<endl;

//cout << endl;

//

//cout << "Input 1st number: ";

//cin >> num1;

//

//cout << "Input 2nd number: ";

//cin >> num2;

//

//

//cout << "The sum of the numbers is : " << num1 + num2 << endl;



//int num1{};

//int num2{};

//cout << "Swap two numbers: "<<endl;

//cout << endl;

//cout << "Input 1st number: ";

//cin >> num1;

//

//cout << "Input 2nd number: ";

//cin >> num2;

//

//cout << "After swapping the 1st number is: " << num2<<endl;

//cout << "After swapping the 2nd number is: " << num1<<endl;


//cout << "Calculate the volume of a sphere: "<<endl;

//cout << endl;

//

//double volume_of_sphere{};

//double radius{};

//

//cout << "Input the radius of a sphere: ";

//cin >> radius;

//

//volume_of_sphere = (4*3.14*radius*radius*radius)/3;

//

//cout << "The volume of a sphere is: "<<volume_of_sphere<<endl;



//cout << "Calculate the volume of a cube: "<<endl;

//cout << endl;

//double side{};

//double volume{};

//

//cout << "Input the side of a cube: ";

//cin >> side;

//

//volume = side * side * side;

//cout << "The volume of a cube: " << volume<<endl;



//cout << "Calculate the volume of a cylinder: "<<endl;

//cout << endl;

//

//double radius{};

//double height{};

//double volume{};

//

//cout << "Input the radius of the cylinder: ";

//cin >> radius;

//

//cout << "Input the height of the cylinder: ";

//cin >> height;

//

//volume = 3.14 * radius * radius * height;

//cout << "The volume of a cylinder is: " << volume<<endl;



//cout << "Find out Area and Perimeter of a Rectangle: "<<endl;

//cout << endl;

//

//double length{};

//double width{};

//double area{};

//double perimeter{};

//

//cout << "Input the length of the rectange: ";

//cin >> length;

//

//cout << "Input the width of the rectangle: ";

//cin >> width;

//

//area = length * width;

//cout << "The area of the rectangle is: "<<area<<endl;

//

//perimeter = 2 * (length + width);

//cout << "The perimeter of the rectangle is: "<<perimeter<<endl;



//cout << "Find the area of any triangle using heron's formula: "<<endl;

//cout << endl;

//

//double semi_perimeter{};

//double side_a{};

//double side_b{};

//double side_c{};

//double area{};

//

//cout << "Input the length of 1st side of the triangle in cm: ";

//cin >>side_a;

//

//cout << "Input the length of 2nd side of the triangle in cm: ";

//cin >>side_b;

//

//cout << "Input the length of 3rd side of the triangle in cm: ";

//cin >>side_c;

//

//semi_perimeter = (side_a + side_b + side_c)/2;

//

//area = sqrt(semi_perimeter * (semi_perimeter - side_a) * (semi_perimeter - side_b)* (semi_perimeter - side_c));

//cout << "The area of the triangle is: "<<area<<endl;



//cout << "Find the area and circumference of any circle: "<<endl;

//cout << endl;

//

//double radius{};

//double circumference{};

//double area{};

//

//cout << "Input the radius (1/2 of diameter) of a circle: ";

//cin >> radius;

//

//area = 3.14 * radius * radius;

//circumference = 2 * 3.14 * radius;

//

//cout << "The area of the circle is: "<<area<<endl;

//cout << "The circumference of the circle is: " << circumference<<endl; 



//cout << "Convert temperature in Celsius to Farenheit " << endl;

//

//int celsius{};

//int farenheit{};

//double celsius_to_farenheit{};

//

//cout << "Input the temperature in Celsius: ";

//cin >> celsius;

//

//celsius_to_farenheit = (9 * celsius)/5 + 32;

//cout << "The temperature in celsius: "<<celsius<<endl;

//cout << "The temperature in Farenheit: "<<celsius_to_farenheit<<endl;



//cout << "Find the third angle of a triangle: "<<endl;

//cout << endl;

//

//int angle_1{};

//int angle_2{};

//int angle_3{};

//const int sum_of_angles{180};

//

//cout << "Input the 1st angle of the triangle:  ";

//cin >> angle_1;

//cout << "Input the 2nd angle of the triangle: ";

//cin >> angle_2;

//

//angle_3 = sum_of_angles - (angle_1 + angle_2);

//cout << "The 3rd angle of the triangle is: "<< angle_3<<endl;



//cout << "Convert kilometers per hour to miles per hour: "<<endl;\

//cout << endl;

//int km_per_hour{};

//const double miles_per_hour{0.62};

//double conversion{};

//

//cout << "Input the distance in kilometer: ";

//cin >> km_per_hour;

//

//conversion = km_per_hour * miles_per_hour;

//cout << "The " <<km_per_hour<<"km/h means " << conversion << " miles/h."<<endl;



//cout << "Convert temperature in Kelvin to Farenheit: "<<endl;

//cout << endl;

//

//double celsius{};

//double farenheit{};

//double kelvin{};

//

//cout << "Input the temperature in kelvin: ";

//cin >> kelvin;

//

//celsius = kelvin - 273;

//farenheit = (9 * celsius)/5 + 32;

//cout << "The temperature in Fahrenheit: "<< farenheit<<endl;



//cout << "Convert temperature in Kelvin to Celsius: "<<endl;

//cout << endl;

//

//double celsius{};

//double kelvin{};

//

//cout << "Input the temperature im Kelvin: ";

//cin >> kelvin;

//cout << "The temperature in kelvin: "<< kelvin<<endl;

//celsius = kelvin - 273;

//cout << "The temperature in kelvin: "<<celsius<<endl;



//cout << "Convert temperature in farhenheit to kelvin: "<<endl;

//cout << endl;

//

//double celsius{};

//double kelvin{};

//double farenheit{};

//

//cout << "Input the temperature in farenheit: ";

//cin >> farenheit;

//

//cout << "The temperature in fahrenheit: "<<farenheit<<endl;

//

//celsius = ((farenheit - 32) * 5)/9;

//kelvin = celsius + 273;

//cout << "The temperature in Kelvin: "<<kelvin<<endl;



//cout << "Convert temperature in celsius to kelvin: "<<endl;

//cout << endl;

//

//double celsius{};

//double kelvin{};

//

//cout << "Input the temperature in Celsius: ";

//cin >> celsius;

//

//kelvin = celsius + 273;

//cout << "The temperature in celsius: "<<celsius<<endl;

//cout << "The temperature in kelvin: "<<kelvin<<endl;



//cout << "Find the area of Scalence triangle: "<<endl;

//cout <<endl;

//

//double side_a{};

//double side_b{};

//double side_c{};

//double semi_perimeter{};

//double area{};

//

//cout << "Input the length of a side of the traingle: ";

//cin >> side_a;

//cout << "Input the length of another side of the traingle: ";

//cin >> side_b;

//cout << "Input the length between these sides of the traingle: ";

//cin >> side_c;

//

//semi_perimeter = (side_a + side_b + side_c)/2;

//area = sqrt(semi_perimeter * (semi_perimeter - side_a) * (semi_perimeter - side_b)* (semi_perimeter - side_c));

//

//cout << "The area of the scalene triangle is: "<<area<<endl;



//cout << "Compute the quotiont and remainder"<<endl;

//cout <<endl;

//

//int quotient{};

//int remainder{};

//int dividend{};

//int divisor{};

//

//cout << "Input the dividend: ";

//cin >> dividend;

//cout << "Input the divisor: ";

//cin >> divisor;

//

//quotient = dividend / divisor;

//cout << "The quotient of the division is: "<<quotient<<endl;

//

//remainder = dividend % divisor;

//cout << "The remainder of the division is: "<<remainder<<endl;



//cout << "Compute the total and average of four numbers: "<<endl;

//cout <<endl;

//

//int num1{};

//int num2{};

//int num3{};

//int num4{};

//double average{};

//double sum{};

//

//cout << "Input 1st two integeral numbers separated by a space: ";

//cin >> num1>>num2;

//cout << "Input last two integeral numbers separated by a space: ";

//cin >> num3>>num4;

//

//sum = num1 + num2 + num3 + num4;

//cout << "The total of four numbers is "<<sum<<endl;

//

//average = sum / 4;

//cout << "The average of the total numbers is: "<<average<<endl;

//int num{};

//cout << "Enter an integer: ";

//cin >> num;

//if (num % 2 ==0)

//    cout << "Num is even"<<endl;

//else

//    cout << "Num is odd"<<endl;

//cout << num << " is "<< ((num % 2 == 0) ? "even" : "odd")<<endl;


//int num1{},num2{};

//cout << "Enter two integers separated by a space ";

//cin >> num1 >> num2;

//

//if (num1 != num2){

//    cout << "Largest: "<< ((num1 > num2) ? num1 : num2) <<endl;

//    cout<<"Smallest: "<< ((num1 < num2) ? num1 : num2)<<endl;

//} else{

//    cout << "The numbers are the same"<<endl;


}



return 0;

}   

Comments

Popular posts from this blog

revison