Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VHB C++ EN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VHB Cpp
VHB C++ EN
Commits
7667a884
Commit
7667a884
authored
6 months ago
by
Rudi Buss
Browse files
Options
Downloads
Patches
Plain Diff
Update Exercise 5 - Farm.txt
parent
ad9346fd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Part 1/4. Control structures/Exercises/Exercise 5 - Farm.txt
+26
-9
26 additions, 9 deletions
Part 1/4. Control structures/Exercises/Exercise 5 - Farm.txt
with
26 additions
and
9 deletions
Part 1/4. Control structures/Exercises/Exercise 5 - Farm.txt
+
26
−
9
View file @
7667a884
Do the following changes to your farm program from Chapter 3 "Exercise
2
- Farm":
Do the following changes to your farm program from Chapter 3 "Exercise
1
- Farm":
Use a switch statement to create a user menu.
The user can type in a number (0, 1 or 2) that calls one of the following functions:
Use a switch statement to create a user menu that calls the following 3 functions:
- 1: Data_query
- 2: Calculate_revenue
- 0: Exit program
The menu should reappear until the user enters the number 0 to exit the program (do-while loop).
A corresponding message should appear if a wrong input has been made.
- 1: Create animal ()
- 2: Display animal ()
- 3: Sell animal (animal number)
- 0: End program
The menu should reappear until the user enters the number for "End program" (do-while loop).
When creating, the following data should be saved:
- Animal type
- Animal number
- Weight
When displaying, the following data should be shown:
- Animal type
- Animal number
- Weight
- Whether the animal is still in stock
When selling, it should be checked whether the animal is still in stock and whether the stored animal number matches the entered animal number.
The following should work:
- Entering the daily price
- Revenue increases (weight * daily price)
- Output of the total revenue
- Animal is then no longer in stock
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment