1) a=((3*x+1.0)/(y-10.0))+sqrt(g)
2) a=((3*x+1)/(y-10))+sqrt(g)
#include <iostream>
using namespace std;
int main()
{
char ch;
cout << "Enter a Character" << endl;
cin>>ch;
if(ch=='A')
cout<<"It is A"<<endl;
else if(ch=='B' || ch=='C')
cout<<"It is B or C"<<endl;
else if(ch=='D')
{
cout<<"It is D"<<endl;
cout<<"Do Better!"<<endl;
}
else
cout<<"It is None!"<<endl;
return 0;
}
![main.cpp [Simmm] - Code Blocks 13.12 File Edit View Search Project Build Debug Fortran waSmith Tools Tools+ Plugins DoxyBlock](http://img.homeworklib.com/questions/f5393ce0-9ed8-11eb-a080-ddad9e2bec05.png?x-oss-process=image/resize,w_560)
Write a c++ expression representing the following algebraic expression. Assume that all variables in your program...
Write a program that will accept an integer as input from the user and test if that input is an even number. It should also test if the input is evenly divisible by 6. The program should display “Even” if the user’s input is even. It should additionally display “divisible by 6” if the user’s input is evenly divisible by six. #include <iostream> using namespace std; int main(){ return 0; } Convert the following switch statement to an if-...
Find the errors in following program. //This program uses a switch statement to assign a // letter grade (A, B, C, D, or F) to numeric test score. #include <iostream> uisng namespace std; int main() { int testScore; cout<<"Enter your test score and I will tell you\n"; cout<<"the letter grade you earned: "; cin>>testScore; switch (testScore) { case (testScore < 60) cout<<"Your grade is F.\n"; break; case (testScore <70) cout<<"Your grade is D.\n" break; case (testScore <80) cout<<"Your grade is...
Find the errors in following program. //This program uses a switch statement to assign a // letter grade (A, B, C, D, or F) to numeric test score. #include <iostream> uisng namespace std; int main() { int testScore; cout<<"Enter your test score and I will tell you\n"; cout<<"the letter grade you earned: "; cin>>testScore; switch (testScore) { case (testScore < 60) cout<<"Your grade is F.\n";...
The switch Statement C++program This lab work with the switch statement. • Remove the break statements from each of the cases. What is the effect on the execution of the program? • Add an additional switch statement that allows for a Passing option for a grade of D or better. Use the sample run given below to model your output. Sample Run: What grade did you earn in Programming I? YOU PASSED! An A - excellent work! The following is...
i want similar for this code to solve two questions : 1- Write a program to convert a postfix expression to infix expression 2-Write a program to convert an infix expression to prefix expression each question in separate code ( so will be two codes ) #include <iostream> #include <string> #define SIZE 50 using namespace std; // structure to represent a stack struct Stack { char s[SIZE]; int top; }; void push(Stack *st, char c) { st->top++; st->s[st->top] = c;...
Assignment #1: Write a C++ Program. Consider the following program segment. // Name: Your Name // MU ID: Your ID // include statement (s) l using namespace statement int main() //variable declaration //executable statements // return statement a. Include the header files isotream. b. Include cin, cout, and endl. c. Declare two variables: numi, num2, num3, and average of type int. d. Assign 125 into numi, 28 into num2, and -25 into num3 e. Store the average of numi, num2,...
Pick a switch statement from the reading. Put it into a main() Java program and make it work. Attach the .java file and copyAndPaste the output into the WriteSubmissionBox The switch Statement S1.51 Multiway if-else statements can become unwieldy when you must choose from among many possible courses of action. If the choice is based on the value of an integer or character expres- sion, the switch statement can make your code easier to read. The switch statement begins with...
Write a program (InfixToPostfix function) to convert an infix expression that includes +,-, * and / to postfix. int main(int argc, const char argv[l) cout <"Final Result : "<< InfixToPostfix("(5+3)*4" return The above main function should display the result below: Final Result 53+4* Here are some uiliy functions that you may find usefal int precedence(char ch) switch (ch) case case- return 1; case case ソ': return 2 '^': return 3; case
C++ programming I need at least three test cases for the program and at least one test has to pass #include <iostream> #include <string> #include <cmath> #include <iomanip> using namespace std; void temperatureCoverter(float cel){ float f = ((cel*9.0)/5.0)+32; cout <<cel<<"C is equivalent to "<<round(f)<<"F"<<endl; } void distanceConverter(float km){ float miles = km * 0.6; cout<<km<<" km is equivalent to "<<fixed<<setprecision(2)<<miles<<" miles"<<endl; } void weightConverter(float kg){ float pounds=kg*2.2; cout<<kg<<" kg is equivalent to "<<fixed<<setprecision(1)<<pounds<<" pounds"<<endl; } int main() { string country;...
Write a MIPS program to demonstrate the operation of the following switch statement. switch (S) { case 5: A = A + 1; break; case 25: A = A - 1; break; default: A = A * 2; break; } Implement and simulate your solution. Allocate .data locations for the variables S and A, and load these values into registers before performing the switch statement on the registers. Run your program several times with different values for these variables, to...