Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VHB C++ DE
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++ DE
Commits
9d2e2ff6
Commit
9d2e2ff6
authored
7 months ago
by
Rudi Buss
Browse files
Options
Downloads
Patches
Plain Diff
Update Solution Exercise 1 - Farm.cpp
parent
8a0b9118
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/3. Functions/Solutions/Solution Exercise 1 - Farm.cpp
+17
-19
17 additions, 19 deletions
Part 1/3. Functions/Solutions/Solution Exercise 1 - Farm.cpp
with
17 additions
and
19 deletions
Part 1/3. Functions/Solutions/Solution Exercise 1 - Farm.cpp
+
17
−
19
View file @
9d2e2ff6
#include
<iostream>
#include
<iostream>
using
namespace
std
;
int
weight
=
0
;
// Declaration and initialization of 3 global variables
int
weight
=
0
;
// Declaration and initialization of 3 global variables
float
dailyPrice
=
0
;
float
revenue
=
0
;
void
Data_query
()
//Declaration and definition of the function Data_query
void
Data_query
()
//
Declaration and definition of the function Data_query
{
cout
<<
"What is the weight? "
<<
endl
;
cin
>>
weight
;
cout
<<
"What is the daily price? "
<<
endl
;
cin
>>
dailyPrice
;
cout
<<
"What is the weight? "
<<
endl
;
cin
>>
weight
;
cout
<<
"What is the daily price? "
<<
endl
;
cin
>>
dailyPrice
;
}
void
Calculate_revenue
()
//Declaration and definition of the function Calcuate_revenue
void
Calculate_revenue
()
//
Declaration and definition of the function Calcuate_revenue
{
revenue
=
weight
*
dailyPrice
;
cout
<<
"Revenue: "
<<
revenue
<<
endl
;
revenue
=
weight
*
dailyPrice
;
cout
<<
"Revenue: "
<<
revenue
<<
endl
;
}
int
main
()
{
//Calling the functions
Data_query
();
Calculate_revenue
();
int
main
()
{
// Calling the functions
Data_query
();
Calculate_revenue
();
cout
<<
endl
<<
endl
;
return
0
;
}
cout
<<
endl
<<
endl
;
return
0
;
}
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