Question

4] points] writing expressions 12 write a CH expression representing the following algebraic expression. Assume that all variables in your program are of the type double and that your program has already included the comath header 3x +1 Your answer: that variables and y in your program the same expression Rewrite Your answer: IQsl [3 points] convert the following switch statement into an equi if statement itch (ch) It is A breaks case c case It is B or break case D It bette cout Do it It is none cout
1 0
Add a comment Improve this question Transcribed image text
Answer #1

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

Add a comment
Know the answer?
Add Answer to:
Write a c++ expression representing the following algebraic expression. Assume that all variables in your program...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Find the errors in following program. //This program uses a switch statement to assign a //...

    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...

  • i want similar for this code to solve two questions : 1- Write a program to...

    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 //...

    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,...

  • Write a program (InfixToPostfix function) to convert an infix expression that includes +,-, * and /...

    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...

    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;...

  • Pick a switch statement from the reading. Put it into a main() Java program and make...

    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 MIPS program to demonstrate the operation of the following switch statement. switch (S) {...

    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...

  • C++ Program What is the output of the following code fragment?(beta is of type int.) beta...

    C++ Program What is the output of the following code fragment?(beta is of type int.) beta = 5; do { switch (beta) { case 1: cout <<'R'; break; case 2: cout case 4: cout << 'O'; break; case 5: cout << 'L'; } beta--; }while (beta>1); cout <<'X';

  • C++ Check Book Program I need to have a checkbook program that uses the following items....

    C++ Check Book Program I need to have a checkbook program that uses the following items. My code that I have appears below. 1) Math operations using built-in math functions 2) Class type in a separate .h file with member functions (accessor functions, get, set, show, display find, etc). There needs to be an overloaded function base/derived classes or a template. 3) Binary File #include <iostream> using namespace std; int main() {     double checking,savings;     cout<<"Enter the initial checking...

  • A) Rewrite the following pseudocode segment in C++ using the loop structures (for and while). Assume...

    A) Rewrite the following pseudocode segment in C++ using the loop structures (for and while). Assume that all the variables are declared and initialized. k-G+ 13)/27 loop: if k> 10 then goto out k=k+1 i=3"k-1 goto loop I out: B) Rewrite the following code segment in C++ using the multiple-selection (switch and if-else) statements. Assume that all the variables are declared and initialized. if((k 1) || (k 2))j-2 k-1 if ((k 3) || ( ks))j - 3.k+1 if (k 4)j-4k-1...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT