Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (6pts) Assume the following variables are defined: int age; double pay; char section; Write a single cin statement that will read input into each

1. (6pts) Assume the following variables are defined:

int age;

double pay;

char section;

Write a single cin statement that will read input into each of these variables.

2. (8pts) Write C++ program expressions for the following algebraic expression:

a = 10x

z = 3x + 8y + 17k

y = 3

g = +16 / 8

c = 4 / 23

3. (6pts) Rewrite the following variable definition so that the variable is a named constantint

int PayRate;

4. (6pts) Write a multiple assignment statement that can be used instead of the following group of assignment statement:

front = 1;

back = 1;

left = 1;

right = 1;

5. (8pts) In C++, list three type casting methods to convert a character to an integer.

6. (6pts) Which one of following statement is equivalent to num /= a + 5 ?

a. num = num / a + 5;

b. num = num / (a + 5);

c. num = / a + 5;

7. (8pts) List two methods to store a single character being read from the user input, assume variable name is ch.

8. (8pts) What is difference between overflow and underflow? List two potential results when floating-point variables overflow or underflow.

Find the error and modify

(11pts x 4 = 44pts)

1.int number1, number2;

float quotient;

cout << Enter two numbers and I will divide ;

cout << the first by the second for you. << endl;

cin >> number1, number2;

quotient = float(number1) / (number2);

cout << quotient;

2.int number1, number2;

float quotient;

cout << Enter two numbers and I will multiply ;

cout << them by 50 for you. << endl;

cin >> number1, number2;

number1 =* 50;

number2 =* 50;

cout << number1 << << number2;

3.char name; //this line defines a string object

cout << Enter your name: ;

getline >> name;

cout << Hi << name << endl; 4. char ch; int num; cout << Enter a number: ; cin >> num; cout << Enter a letter: ; cin.get();//store user input to ch cout << ch << endl;cout << Hi << name << endl; 4. char ch; int num; cout << Enter a number: ; cin >> num; cout << Enter a letter: ; cin.get();//store user input to ch cout << ch << endl;

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

What activities should the team leader participate in?

Answered: 1 week ago

Question

suppose X~ N (8,1). what value of x has a z-score of -2.25

Answered: 1 week ago

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago