,,1. Which of the following statments are valid C++ statements? A) cout << "Hello World" : B) cout << Hello World; C) cout << "Hello " << "World" ; D) cout << "Hello"
<< "World" ;
2. What is the difference between the literals 'A' and "A"?
,3.
Read the input from user;
Check for valid entries
If input is invalid:
print an error message;
else:
calculate the result and print to the console;
exit;
The code snippet above may be best described as...
,,4. Complete the following program statements that initialize two variables, x and y, Multiplies them together and stores the result in the variable, z.
5. T/F A string literal with 5 characters requires 5 bytes of storage.
6.What is the value of x after the following statements are executed?
int x;
x = 7.2;
7.
What is printed by the following statement?
string month = "April";
string day = 26;
cout << "Her birthday" << " is " << endl << month << '\n' << day + 1;
Answer 1:cout << "Hello " << "World" ;
statement should end with ;
Answer 2:'A' is character and "A" is an string
Answer 3:PSEUDO CODE
Answer 4: int x=2,y=2;
int z=y*x;
Answer 5:true
Answer 6: 7
as the x is type of int
Answer 7:it will give error as string should be enclosed inside
""
,,1. Which of the following statments are valid C++ statements? A) cout << "Hello World" :...
Language is C++ Complete the following Review Questions: 1. This is a control structure that repeats a group of statements in a program? a. loop b. switch c. main() function d. compiler 2. In the expression number++,the ++operator is in what mode? a. Prefix b. Pretest c. Postfix d. Posttest 3.This is a variable that controls the number of iterations performed by a loop. a. Loop control variable b. Accumulator c. Iteration register variable d. Repetition meter 4. The do-whileloop...
Complete the following statements or correct them. All codes must print Hello 10 times. for( c<10){cout<<”Hola” while x=0 cout do cout<<”Hola while()
QUESTION 1 What is the output of the following code snippet? int main() { bool attendance = false; string str = "Unknown"; attendance = !(attendance); if (!attendance) { str = "False"; } if (attendance) { attendance = false; } if (attendance) { str = "True"; } else { str = "Maybe"; } cout << str << endl; return 0; } False True Unknown Maybe QUESTION 2 What is the output of the following code snippet? #include <iostream> #include <string> using...
Question 3 Run the following code and explain, using your own words, what is happening with each variable (w,x,y,z) and what is the difference between ++x and w++ (is there any influence on the result between prefix or postfix ++ operator?). Provide a snippet of the output showing the result. int main() { int w = 20, x = 20; int y = 5, z = 5; y = y + (++x); z = z + (w++); cout << "x="...
Python: 1) Consider the following code segment: try : inputFile = open("lyrics.txt", "r") line = inputFile.readline() print(line) _____________________ print("Error") What should be placed in the blank so that the program will print Error instead of crashing if an exception occurs while opening or reading from the file? Group of answer choices a- except RuntimeError : b- except EnvironmentError : c- except IOError : d- except IndexError : 2) Consider the following code segment: line = "hello world!" parts = line.split()...
C++ edit: You start with the code given and then modify it so that it does what the following asks for. Create an EmployeeException class whose constructor receives a String that consists of an employee’s ID and pay rate. Modify the Employee class so that it has two more fields, idNum and hourlyWage. The Employee constructor requires values for both fields. Upon construction, throw an EmployeeException if the hourlyWage is less than $6.00 or over $50.00. Write a program that...
so i have my c++ code and ive been working on this for hours
but i cant get it to run im not allowed to use arrays. im not sure
how to fix it thank you for the help
our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses...
QUESTION 7 Which of the following is a valid C++ assignment statement? (assume each letter is a different variable) A.y=b-c B.y +z = x C.x = a bi D.x = -(y*z): Ex = (x + (y z): QUESTION 8 Which of the following is a valid variable name according to C++ naming rules? A 2ndName B.%Last_Name C@Month D#55 Eyear03 QUESTION 9 Which library must be included to enable keyboard input? A kbdin B. cstdlib C input Diostream E lomanip QUESTION...
C++
Banks offer various types of accounts, such as savings,
checking, certificate of deposits, and money market, to attract
customers as well as meet their specific needs. Two of the most
commonly used accounts are savings and checking. Each of these
accounts has various options. For example, you may have a savings
account that requires no minimum balance but has a lower interest
rate. Similarly, you may have a checking account that limits the
number of checks you may write....
In C++ please Q4: There are 10 items in the shopping cart. 1. Assign a random price between 20-60 to each item. 2. Calculate the price maximum in the cart. If the price maximum is less than 55, re-run step 1. 3. If the class maximum is greater than 55, then print out price for every item to the screen. Answer: Q5: Write title lines for the functions that are called by the following main program. Do not supply the...