Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 h02 CS16 W19 6. (4 pts) Write an if-else statement that outputs the string Grade is B if the variable `score` is between 80

2
h02
CS16 W19
  1. 6. (4 pts) Write an if-else statement that outputs the string "Grade is B" if the variable `score` is between 80 and 90 (both limits included). Otherwise the if-else statement should output "Grade is not B" ?7. (4 pts) The program below intends to do the following: Repeatedly prompt the user to input an integer number. When the user no longer wants to continue entering numbers, output the sum of all the positive numbers entered by the user followed by the sum of all the negative numbers entered by the user. However, the given program has errors. Mark all logical and syntax errors in the program and provide corrections in the space provided to the right. Add missing statements if any.
    #include  int main(){ int a , sumPositive, sumNegative; string promptContinue =" To continue enter Y/y "; string promptNum = " Enter a number: "; char response; while (response = 'y'||`Y') { cout << promptNum; cin >> a; if(a) sumPositive+=a; else sumNegative+=a; cout<< promptContinue; } cout<< "Sum of all the positive numbers is: "<< sumPositive< 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data 29th British National Conference On Databases Bncod 2013 Oxford Uk July 2013 Proceedings Lncs 7968

Authors: Dan Olteanu ,Georg Gottlob ,Christian Schallhart

2013th Edition

3642394663, 978-3642394669

More Books

Students also viewed these Databases questions

Question

Describe a persuasive message.

Answered: 1 week ago

Question

Identify and use the five steps for conducting research.

Answered: 1 week ago

Question

List the goals of a persuasive message.

Answered: 1 week ago