• 0

C++ simple question


Question

hi, i am a beginner and i have 2 quesion 

 

1. Use for loop to write the C++ program that display the integers from 0 to 50.

2. Write the C++ program that displays the message "Input error" when a user enters an integer less than or equal to 0 for the integer variable called units.

3. Modify the C++ program in exercise 2 such that it displays the message "Input error" when a user enters 0 or less for the variable called units; otherwise, it computes the total owed by multiplying the units by 5 and stores this product into the variable called total, and then displays the total value.

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

1. Write the C++ program that prompts a user to enter an integer value as follows: Enter an integer: The program takes the user-input integer value and stores it into the variable called x. The x variable has the int data type. The program then displays the user-input integer value as follows if the user-input integer value is 8: The integer you have just entered is: 8

2. Modify the above C++ program such that it computes the user input value plus 3, and the result times 9. The program then displays the computation result as follows if the user-input integer value is 8: The integer you have just entered plus 3, then the result times 9: 99

3. Write the C++ program that takes a user-input value and stores it into the variable called Celcius. The Celcius variable has the float data type. The program then converts the user input into a new value based on the following formula, stores the new value into the float variable called Fahrenheit and displays the Fahrenheit value: Fahrenheit = Celcius × 5/9 + 32

 

please help 

thank you

Link to comment
https://www.neowin.net/forum/topic/1280348-c-simple-question/
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Posts

    • When I was a teen, I actually believed that the government used to be always be the bad guy. However as an adult, someone who has actually seen the Law work (though not perfect). I now think everyone cries a river. In this specific case, the so called freedom has consequences to society. Anyone who has seen how child are indeed affected, and I don't mean only extreme things like getting drugs or hate crimen , but no one can deny society as a whole has gone down a rabbit hole due to exesive use of internet. Before anyone calls out that it's the parents responsibility. Yes that's true, but the reality your family/kids might be good people. There are 99% out there who are not and have been brain dead by many things on the internet.
    • Siri AI : iPhone Air, iPhone 17 Pro iPad with M4 and later with 12GB or more in memory Mac with M3 and later with 12GB or more in memory
    • Siri AI will only work locally on these new machines. Not great iPhone Air, iPhone 17 Pro iPad with M4 and later with 12GB or more in memory Mac with M3 and later with 12GB or more in memory
    • Universal Media Server 15.6.0 by Razvan Serea Universal Media Server is a DLNA-compliant UPnP Media Server. UMS was started by SubJunk, an official developer of PMS, in order to ensure greater stability and file-compatibility. The program streams or transcodes many different media formats with little or no configuration. It is powered by MEncoder, FFmpeg, tsMuxeR, AviSynth, MediaInfo and more, which combine to offer support for a wide range of media formats. Because it is written in Java, Universal Media Server supports all major operating systems, with versions for Windows, Linux and Mac OS X. To see a comparison of popular media servers, click here. Universal Media Server 15.6.0 changelog: General Added Discogs integration for audio metadata and UPnP Added new options for DNS resolution handling (thanks, @henry701 Henrique Campos!) Added a loading indicator to the Shared Content area on the web settings (#6037) Improved detection of sample videos Improved stability of speed test (thanks, @henry701 Henrique Campos!) Fixed support for servers with no Internet access (#6047) (thanks, @henry701 Henrique Campos!) Fixed wrong Linux yt-dlp binary being packaged (#6011) (thanks, @Pro-pra!) Fixed API lookups happening for TV series when episode lookup fails, even if the series metadata is already in the local database (#6080) Fixed JDK being used in Docker image instead of JRE (#6089) (thanks, @mvanhorn Matt Van Horn!) Fixed editing a video feed on the web settings erases the URL (#6046) (thanks, @serinekjo kjo!) Fixed docs for FFmpeg GPU support (thanks, @Harshit-dell Harshit Kumar Sahu!) Translation updates via Crowdin Dutch (97%) (thanks, Lefteye!) English (United Kingdom) (80%) (thanks, Andi Chandler!) Italian (63%) (thanks, parduz!) Portuguese (Brazilian) (67%) (thanks, Henrique Campos!) Download: Universal Media Server 15.6.0 | 157.0 MB (Open Source) Download: Other operating systems View: Universal Media Server Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Very Popular
      Captain_Eric earned a badge
      Very Popular
    • One Month Later
      amusc earned a badge
      One Month Later
    • One Month Later
      DJC50PLUS earned a badge
      One Month Later
    • Week One Done
      DJC50PLUS earned a badge
      Week One Done
    • Proficient
      Eric Biran went up a rank
      Proficient
  • Popular Contributors

    1. 1
      +primortal
      509
    2. 2
      PsYcHoKiLLa
      222
    3. 3
      ATLien_0
      92
    4. 4
      +Edouard
      86
    5. 5
      Steven P.
      81
  • Tell a friend

    Love Neowin? Tell a friend!