Question

Part E - Using 3 char variables, display the sum of 33, 35, and 37. Ask...

Part E - Using 3 char variables, display the sum of 33, 35, and 37. Ask how to use "static_cast" in your cout
Part F - Show the night-time low temperature if the day-time high is 43 degrees F, and the spread is 50 degrees.
Part G - Display "Hello, World", using a string literal for Hello, and a string object for World.

test data:

The sum of 33, 35 and 37 is 105
The low temperature is -7 degrees.
Hello, World

This is C++ and use visual studio please.

Use blank lines to separate the major parts of your main function.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hey Friend !

Here are the answers to these questions. Screenshot attached. Thanks for a thumbs up. One more please : )

_________________________________________________________________________________________________

#include<iostream>
using namespace std;
int main(){

//Part A - The MPG (in whole numbers) of a car that can travel 400 miles on a 16 gallon fuel tank.
int mpg=400/16;
cout<<"400 miles using 16 gallons yields "<<mpg<<" MPG."<<endl;
//Part B - Total capacity of 3 theaters which hold 90 people each, and one that holds 150.
int theaters=3*90+120;
cout<<"Total theater capacity is: "<<theaters<<" people."<<endl;
//Part C - How far (in miles) to go to Mercury (56,974,146), then Saturn (849,221,795), then home (792,248,270)
long distance=56974146+849221795+792248270;
cout<<"Total distance: "<<distance<<endl;
//Part D - Using 3 char variables, display: ABC and A B C, and the 3 on 3 separate lines.
char a='A',b='B',c='C';
cout<<a<<b<<c<<endl;
cout<<a<<" "<<b<<" "<<c<<endl;
cout<<a<<endl<<b<<endl<<c<<endl;
//Part E - Using 3 char variables, display the sum of 33, 35, and 37. Ask how to use "static_cast" in your cout
char x=33;
char y=35;
char z=37;
cout<<"The sum of 33, 35 and 37 is "<<static_cast<int>(x+y+z)<<endl;
//Part F - Show the night-time low temperature if the day-time high is 43 degrees F, and the spread is 50 degrees.
int day_time_temp=43;
int spread=50;
cout<<"The low temperature is "<<day_time_temp-spread<<" degrees."<<endl;
//Part G - Display "Hello, World", using a string literal for Hello, and a string object for World.
string hello="Hello, ";
string world="World";
cout<<hello<<world<<endl;

}

____________________________________________________________________________________________

thank you so much !

Add a comment
Know the answer?
Add Answer to:
Part E - Using 3 char variables, display the sum of 33, 35, and 37. Ask...
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
  • Part 3.  Write a program to dynamically allocate some char buffers, use memset to fill them, and...

    Part 3.  Write a program to dynamically allocate some char buffers, use memset to fill them, and use memcpy and memmove to move the data around. I suggest you do part 3a, test and verify it’s working as expected, then add part b, test & verify, then do part 3c.  You only need to turn in the complete program, but doing it in steps will help both with understanding and if you have bugs along the way. Part 3a. a.Allocate 2 char...

  • Name: True/False & Multiple Choice (2 points each) (True / False ) 2 A char literal...

    Name: True/False & Multiple Choice (2 points each) (True / False ) 2 A char literal '2', a string literal "2", and the numeric literal 2 are identical and stored the same way though they are different types. 3 Since comments do not affect the program execution, you don't need to have it at all. 4. After the following statements are executed, the value of the variable rem is 3. 1. A preprocessor directive line starts with a pound sign...

  • #include <iostream> #include <iomanip> #include <vector> using namespace std; Part 1. [30 points] In this part,...

    #include <iostream> #include <iomanip> #include <vector> using namespace std; Part 1. [30 points] In this part, your program loads a vending machine serving cold drinks. You start with many foods, some are drinks. Your code loads a vending machine from foods, or, it uses water as a default drink. Create class Drink, make an array of drinks, load it and display it. Part 1 steps: [5 points] Create a class called Drink that contains information about a single drink. Provide...

  • so i have my c++ code and ive been working on this for hours but i...

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

  • The last 3 cases are tests .cpp files to test the code. The language of this...

    The last 3 cases are tests .cpp files to test the code. The language of this code must be C++ because that is the only I am familiar with. Soreland, a software company, is planning on releasing its first C++ compiler with the hopes of putting MiniSoft's Visual C++ out of business (that reminds me of another story). Consequently, Soreland has contracted with the Fruugle Corporation to design and build part of their compiler. Of course, since Fruugle gets all...

  • These are my answere to the following questions: are they right? 1. B 2. T 3....

    These are my answere to the following questions: are they right? 1. B 2. T 3. T 4. T 5. F 6. T 7. A 8. D 9. E 10. B 11. B 12. A 13. A 14. D 15. C 16. D 17. T 18. C 19. T 20. T 21. T 22. A 23. T 24. D 25. B 26. A 27. A 28. A 29. T 30. C 31. D 32. A 33. T 34. F 35....

  • okay so here is my c++ code and the errors im really stuck on fixing what...

    okay so here is my c++ code and the errors im really stuck on fixing what i did wrong it seems to be the same repeated error 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 A your program should use a loop and your morse code printing...

  • PART 1 PART 2 PART 3 PART 4 PART 5 PART 6 PART 7 PART 8...

    PART 1 PART 2 PART 3 PART 4 PART 5 PART 6 PART 7 PART 8 -11 points BBUnderStat12 22 005 Ask Your Teache My Notes It is costly in both time and money to go to college. Does it pay off? According to the Bureau of the Census, the answer is yes. The average annual income (in thousands of dollars) of a household headed by a person with the stated education level is as follows: 24.9 if ninth grade...

  • 18.1 Lab Lesson 11 (Part 1 of 1) Part of lab lesson 11 There in one...

    18.1 Lab Lesson 11 (Part 1 of 1) Part of lab lesson 11 There in one part to lab lesson 11. The entire lab will be worth 100 points. Lab lesson 11 part 1 is worth 100 points For part 1 you will have 80 points if you enter the program and successfully run the program tests. An additional 20 points will be based on the style and formatting of your C++ code. Style points The 20 points for coding...

  • Use C++ For this week’s lab you will write a program to read a data file...

    Use C++ For this week’s lab you will write a program to read a data file containing numerical values, one per line. The program should compute average of the numbers and also find the smallest and the largest value in the file. You may assume that the data file will have EXACTLY 100 integer values in it. Process all the values out of the data file. Show the average, smallest, largest, and the name of the data file in the...

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