Short Answer Questions 1. Write a single C++ statement that will: Print the string “C++” using the variable: string s = “Introduction to C++”. 2. Change the letter ‘c’ to ‘C in the following string:...

1 answer below »
not question 9


Short Answer Questions 1. Write a single C++ statement that will: Print the string “C++” using the variable: string s = “Introduction to C++”. 2. Change the letter ‘c’ to ‘C in the following string: Reprint the string with “C” given the code and using the string: string greeting = “Introduction to c++” 3. Write the C++ statement or statements that will: Print the answer for regular division of the real numbers a / b + c and print the answer for integer division of the same values for integer numbers d / e + f. For example, given float a=13, b=3, c = 10, the statements would print : Regular division result = 14.3333 Integer division result = 14 4. Write the C++ statement or statements that will generate a random number between 100 and 110: 5. Write a C++ statement or statements that will: Print the first two digits and the last two digits of any 4 digit number stored in an integer variable n. For example, given int n = 5623, print 56 23. 6. Write C++ statements that will align the following three lines as printed in two 20 character columns. Name Years President Abraham Lincoln1860-1865 Thomas Jefferson1801-1809 7. Write a C++ statement or statements that will Output if a string has a length greater than 10, equal to 10 or less than 10. Examples : string str1 = “Four Score and Seven Years Ago” would output “String Length > 10” string str2 = “Good Day” would output “String Length < 10”="" string="" str3="0123456789”" would="" output="" “string="" length="10”" 8.="" create="" a="" truth="" table="" and="" determine="" the="" results="" for="" the="" following="" equation="" and="" values="" equation="" :="" bool="" b="">< 7)="" ||="" ((b-a=""> 10) && !(c*a == 8))) Values : a = 2; b = 8; c = 4 9. Write a program using Atom and submit via Blackboard. a. Request an integer whole dollar amount from the console. b. Using the least amount of bills ($50,$20,$10,$5,$1) necessary, calculate how many of each bill type you will need to get to that value. Output Example 1 (input is bold and italicized) Enter a whole dollar amount as n integer: 633 You will need: 12 $50 bill(s). 1 $20 bill(s). 1 $10 bill(s). 0 $5 bills(s). 3 $1 bill(s). Output Example 2 (input is bold and italicized) Enter a whole dollar amount as an integer: 364 You will need: 7 $50 bill(s). 0 $20 bill(s). 1 $10 bill(s). 0 $5 bills(s). 4 $1 bills(s).
Answered Same DayMay 15, 2021

Answer To: Short Answer Questions 1. Write a single C++ statement that will: Print the string “C++” using the...

Chirag answered on May 15 2021
141 Votes
Short Answer Questions
1. Write a single C++ statement that will:    
Print the string “C++” using the variable:     string s = “Int
roduction to C++”.

Answer:: string s=”C++”;
     cout<

2. Change the letter ‘c’ to ‘C in the following string:    
Reprint the string with “C” given the code and using the string: string greeting = “Introduction to c++”
Answer::
#include
#include
using namespace std;
int main()
{
string s="Introduction to c++";
for(int i=0;i {
if(s[i]=='c')
s[i]='C';
}
cout<    return 0;
}

3. Write the C++ statement or statements that will:    
Print the answer for regular division of the real numbers a / b + c and print the answer for integer division of the same values for integer numbers d / e + f.
For example, given float a=13, b=3, c = 10, the statements would print :
Regular division result = 14.3333
Integer division result = 14
Answer::
int main()
{
float a=13, b=3, c=10;
int d=13, e=3, f=10;

cout<< a / b + c < cout<< d / e + f<    return 0;
}



4. Write the C++ statement or statements that will generate a random number between 100 and 110:
    
Answer::
void main()
{
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here