
TRANSLATE FOLLOWING PROGRAM IN NESTED IF LOOP
#include<stdio.h>
#include<conio.h>
int main()
{
char s[5];
printf("\n Enter any operator:");
scanf("%s",s);
switch(s[0]) {
case'>': if(s[1]=='=') printf("\n Greater than or equal");
else if(s[1]=='>') if (s[2]=='=')printf("\n Right shift AND assignment operator");
else if(s[1]=='>') printf("\nBinary right shift Operator");
else printf("\n Greater than");
break;
case'<': if(s[1]=='=') printf("\n Less than or equal");
else if(s[1]=='<') if (s[2]=='=')printf("\n Left shift AND assignment operator");
else if(s[1]=='<') printf("\nBinary left shift Operator");
else printf("\nLess than");
break;
case'=': if(s[1]=='=') printf("\nEqual to");
else printf("\nAssignment");
break;
case'!': if(s[1]=='=') printf("\nNot Equal");
else printf("\n Bit Not");
break;
case'&': if(s[1]=='&') printf("\nLogical AND");
else if (s[1]=='=')printf("\nBitwise AND assignment operator");
else printf("\n Bitwise AND");
break;
case'|': if(s[1]=='|') printf("\nLogical OR");
else if (s[1]=='=')printf("\nBitwise inclusive OR and assignment operator");
else printf("\nBitwise OR");
break;
case'+':if(s[1]=='+') printf("\nincrement operator");
else if(s[1]=='=') printf("\nAdd AND assignment Operator");
else printf("\n Addition");
break;
case'-':if(s[1]=='-') printf("\ndecrement Operator");
else if(s[1]=='=') printf("\nsubtract AND assignment Operator");
else printf("\nSubtraction");
break;
case'*':if(s[1]=='=') printf("\nMultiply AND assignment operator");
else printf("\nMultiplication");
break;
case'/':if(s[1]=='=') printf("\nDivide AND assignment operator");
else printf("\nDivision");
break;
case'%': if(s[1]=='=') printf("\nModulus AND assignment operator");
else printf("Modulus");
break;
case'^': if(s[1]=='=') printf("\nBitwise exclusive OR and assignment operator");
else printf("\nBinary XOR Operator");
break;
case'~': printf("\nBinary one's complement operator");
break;
case'?': if(s[1]==':') printf("\nConditional operator");
break;
default: printf("\n Not a operator");
} return 1;
}

Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images

- #include <iostream> #include <cmath> using namespace std; // declare functions void display_menu(); void convert_temp(); double to_celsius(double fahrenheit); double to_fahrenheit(double celsius); int main() { cout << "Convert Temperatures\n\n"; display_menu(); char again = 'y'; while (again == 'y') { convert_temp(); cout << "Convert another temperature? (y/n): "; cin >> again; cout << endl; } cout << "Bye!\n"; } // define functions void display_menu() { cout << "MENU\n" << "1. Fahrenheit to Celsius\n" << "2. Celsius to Fahrenheit\n\n"; } void convert_temp() { int option; cout << "Enter a menu option: "; cin >> option; double f = 0.0; double c = 0.0; switch (option) { case 1: cout << "Enter degrees Fahrenheit: "; cin >> f; c =…arrow_forwardC PROGRAMMING LANGUAGE What are the values of x and y inside the main function at /*values here */ in the following code assume all proper header files included void hello (int *x);int main(void){int x,y;x=35;y=14;hello(&x);hello(&y); /* values here */}void hello (int *x){int y;y=*x + 2;*x = 2 * *x;}arrow_forwardIt wont display the order total // JumpinJava.cpp - This program looks up and prints the names and prices of coffee orders. // Input: Interactive // Output: Name and price of coffee orders or error message if add-in is not found #include <iostream> #include <string> using namespace std; int main() { // Declare variables. string addIn; // Add-in ordered const int NUM_ITEMS = 5; // Named constant // Initialized array of add-ins string addIns[] = {"Cream", "Cinnamon", "Chocolate", "Amaretto", "Whiskey"}; // Initialized array of add-in prices double addInPrices[] = {.89, .25, .59, 1.50, 1.75}; bool foundIt = false; // Flag variable int x; // Loop control variable double orderTotal = 2.00; // All orders start with a 2.00 charge // Get user input cout << "Enter coffee add-in or XXX to quit: "; cin >> addIn; // Write the rest of the program here. while(addIn != "XXX") //loop until user…arrow_forward
- ê #include using namespace std; int main() { int count = 5; int num = 2; while (count r && num ){ cout << count << " " << num << endl; count -=1; if (count % 2 == 0) num -=1; } return 0; Output: 52 4 1 3 1 20 10arrow_forwardPlease correct the program in c++arrow_forward#include <iostream> #include <cmath> using namespace std; // declare functions void display_menu(); void convert_temp(); double to_celsius(double fahrenheit); double to_fahrenheit(double celsius); int main() { cout << "Convert Temperatures\n\n"; display_menu(); char again = 'y'; while (again == 'y') { convert_temp(); cout << "Convert another temperature? (y/n): "; cin >> again; cout << endl; } cout << "Bye!\n"; } // define functions void display_menu() { cout << "MENU\n" << "1. Fahrenheit to Celsius\n" << "2. Celsius to Fahrenheit\n\n"; } void convert_temp() { int option; cout << "Enter a menu option: "; cin >> option; double f = 0.0; double c = 0.0; switch (option) { case 1: cout << "Enter degrees Fahrenheit: "; cin >> f; c =…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





