Question

C++programming plese i need all codes in this homework 2. Homework 1) Read 3 numbers and...

C++programming

plese i need all codes in this homework

2. Homework

1) Read 3 numbers and display them in descending order.

Enter 3 numbers

5 9 3

In descending order: 9 5 3

2) Implement following menu system.

food

   Korean

       Rice, Bulgogi

   American

       Hamburger, Salad

   Chinese

       Noodle, Dimsum

drink

   Cola, Orange juice, Water

Select a menu

1. food 2. drink

1

You have selected food. Which food?

1. Korean 2. American 3. Chinese

2

You have selected an American food. Which American food?

1. Hamburger 2. Salad

1

Enjoy your hamburger!

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

1) Program to read three numbers and display them in descending order.

  

#include <iostream>
using namespace std;

int main() {
   // your code goes here
   int input_array[3],index;
   for(int i=0;i<3;i++)
cin>>input_array[i];
   for(int i=0;i<3;i++){
   for(int j=i;j<3;j++){
   if(input_array[i]<input_array[j]){
   int temp=input_array[j];
   input_array[j]=input_array[i];
   input_array[i]=temp;
   }
   }
   cout<<input_array[i];
  
  
   }
   return 0;
}

output:

2) program to display the menu

#include <iostream>
using namespace std;

int main() {
   // your code goes here
int input;
cout<< "select a menu\n";
cout<<"1. food 2. drink\n";
   cin>>input;
   if(input==1){
   cout<<"you have selected food. Which food?\n";
   cout<<"1. Korean 2. American 3.Chinese\n";
   cin>>input;
   if(input==1)
   {
   cout<<"you have selected Korean food. Which Korean food?\n";
   cout<< "1. Rice 2. Bulgogi\n";
   cin>>input;
   if(input==1)
   cout<<" enjoy your Rice!";
   else
   cout<<"enjoy your Bulgogi!";
   }
   else if(input==2){
   cout<<"you have selected American food. Which American food?\n";
cout<<"1. Hamburger 2.Salad \n";
cin>> input;
if(input==1)
cout<<"Enjoy your Hamburger!";
else
cout<<"Enjoy your Salad!";
   }
     
   else
   {
   cout<<"you have selected Chinese food. Which Chinese food?\n";
   cout<<"1. Noodles 2. Dimsum\n";
   cin>>input;
   if(input==1)
   cout<<"Enjoy your Noodles!";
     
   else
   cout<<"Enjoy your Dimsum!";
   }
   }
   else
   {
   cout<<"You have selected drinks\n";
   cout<<"1. Cola 2.Orange juice 3.Water\n";
   cin>> input;
   if(input==1)
   cout<<"enjoy your Cola!";
   else if(input==2)
   cout<<"enjoy your Orange juice!";
   else if(input==3)
   cout<<"enjoy your Water!";
   }
  
   return 0;
}

output:

Add a comment
Know the answer?
Add Answer to:
C++programming plese i need all codes in this homework 2. Homework 1) Read 3 numbers and...
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
  • Using the iProfile Case Study: Folic Acid from your WileyPlus iProfile resources, enter Kelly Watson’s data...

    Using the iProfile Case Study: Folic Acid from your WileyPlus iProfile resources, enter Kelly Watson’s data into the program in order to answer the following question. Use report: Single Nutrient Report: Folate (DFE) Enriched foods are good sources of folic acid. Which food in the one-day menu is likely to be enriched because it contains the greatest amount of folate (DFE)? Salad, Green Cake, White, with Icing Rice, White, Long Grain, Enriched, Instant, Boiled COCA-COLA Coke Soda Choose OneKilocaloriesCalories from...

  • Food Group Amounts for 2,200 Calories a Day Vegetables Dairy Protein Grains Fruits 3 cups 6...

    Food Group Amounts for 2,200 Calories a Day Vegetables Dairy Protein Grains Fruits 3 cups 6 ounces 3 cups 2 cups 7 ounces Move to low-fat or Vary your protein routine Make half your grains whole grains Vary your veggies Focus on whole fruits fat-free milk or yogurt Choose fat-free milk, yogurt, and soy beverages (soy milk) to cut back on your saturated Mix up your protein foods to include seafood, beans and peas, unsalted nuts and seeds, soy products,...

  • please numbers 1-4 and please type it out. 1 of 1 Dr. Smruti A. Desai Nutrition...

    please numbers 1-4 and please type it out. 1 of 1 Dr. Smruti A. Desai Nutrition (BIOL 1322) Nutrition Facts Sening Size 12 cup (120 m) condensed soup Per Contaner abot 25 Homework 4: Increasing Dietary Fiber Erin C. is a single woman who has been advised by her doctor to increase her intake of dietary fiber due to frequent constipation. Her intake over the past 24 hours includes: 8 oz orange juice, 2 cups coffee with cream, 2 slices...

  • (C++ programming) Need help with homework. Write a program that can be used to gather statistical...

    (C++ programming) Need help with homework. Write a program that can be used to gather statistical data about the number of hours per week college students play video games. The program should perform the following steps: 1). Read data from the input file into a dynamically allocated array. The first number in the input file, n, represents the number of students that were surveyed. First read this number then use it to dynamically allocate an array of n integers. On...

  • I need this in C not C++ just C SET-151 C Programming #1 Homework: 7 String...

    I need this in C not C++ just C SET-151 C Programming #1 Homework: 7 String Basics – Death by a thousand strings.                                                                                                                                                                         Reading(s): Chapter(s) in C Primer Plus 1-7, 9, 10 please use this format // ------------------------------------------------------------------------------------------ // Name: Your name here // Class: C Programming // Abstract: Homework 1. // ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------ // Includes // ------------------------------------------------------------------------------------------ #include<stdio.h> #include<stdlib.h> // ------------------------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------ // Prototypes // ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------ // Name: main //...

  • Using the iProfile Case Study: Folic Acid from your WileyPlus iProfile resources, enter Kelly Watson’s data into the pro...

    Using the iProfile Case Study: Folic Acid from your WileyPlus iProfile resources, enter Kelly Watson’s data into the program in order to answer the following question. Use report: Single Nutrient Report: Folate (DFE) Kelly Watson would be at increased risk for folate deficiency if she was pregnant. she was elderly. she was a premature infant. All of these put Kelly at risk for folate deficiency. Choose OneKilocaloriesCalories from FatFat, TotalSaturated FatTrans Fatty AcidMonounsaturated FatPolyunsaturated FatPFA 18:2, LinoleicPFA 18:3, LinolenicCholesterolCarbohydrateSugar, TotalDietary...

  • I REALLY need numbers 2 and 3 and 5 by like tomorrow morning. I have no...

    I REALLY need numbers 2 and 3 and 5 by like tomorrow morning. I have no clue how to do these. I know the image quality is iffy but please help as best you can Homework1 STA4322 Homework 1, Spring 2019 Please turn in your own work, though you may discuss the problems with classmates, the TA, the Professor, the internet, etc. The most important thing is that you understand the problems and how they are solved as they will...

  • Case Study 26-2: Military Wife with Gestational Diabetes Amelia Smith is a 31-year-old military wife referred...

    Case Study 26-2: Military Wife with Gestational Diabetes Amelia Smith is a 31-year-old military wife referred to a registered dietitian after being diagnosed with gestational diabetes at 30 weeks of pregnancy. She is 65 inches tall and weighs 215 pounds. Her pre-pregnancy weight was 185 pounds. Her first child weighed 9 pounds 7 ounces at birth but she states she was never diagnosed with GDM during that pregnancy. She is on a limited budget and says she shops in bulk...

  • Using the iProfile Case Study: Folic Acid from your WileyPlus iProfile resources, enter Kelly Watson’s data...

    Using the iProfile Case Study: Folic Acid from your WileyPlus iProfile resources, enter Kelly Watson’s data into the program in order to answer the following question. Use report: Single Nutrient Report: Folate (DFE) If Kelly Watson were to continually consume less than optimal levels of folic acid, she would be at risk for developing megaloblastic (or macrocytic) anemia. The red blood cells of megaloblastic anemia are large and immature. small and immature. large and mature. small and mature. Choose OneKilocaloriesCalories...

  • Using the iProfile Case Study: Folic Acid from your WileyPlus iProfile resources, enter Kelly Watson’s data into the pro...

    Using the iProfile Case Study: Folic Acid from your WileyPlus iProfile resources, enter Kelly Watson’s data into the program in order to answer the following question. Use report: Single Nutrient Report: Folate (DFE) Alcoholics are at increased risk for folate deficiency. Why are alcoholics at increased risk for folate deficiency? Alcohol inactivates folate in the lung’s cell lining. Alcohol promotes rapid rates of cell division and growth. Alcohol inhibits the absorption of folate. All of these are reasons why alcoholics...

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