Simple Function Practice
Example of the function with arguments from the previous chapter
function.h
123456double convert_usd_to_eur(double usd_amount) { const double exchange_rate = 0.91; double euros = usd_amount * exchange_rate; return euros; }
Swipe to start coding
Create a function withdraw
that simulates a bank account withdrawal. It accepts the current balance and withdrawal amount as arguments. If the balance is sufficient, deduct the amount and return the new balance. Otherwise, return the original balance.
Solution
solution.cpp
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 4Awesome!
Completion rate improved to 4
Simple Function Practice
Example of the function with arguments from the previous chapter
function.h
123456double convert_usd_to_eur(double usd_amount) { const double exchange_rate = 0.91; double euros = usd_amount * exchange_rate; return euros; }
Swipe to start coding
Create a function withdraw
that simulates a bank account withdrawal. It accepts the current balance and withdrawal amount as arguments. If the balance is sufficient, deduct the amount and return the new balance. Otherwise, return the original balance.
Solution
solution.cpp
Thanks for your feedback!
single
Awesome!
Completion rate improved to 4
Simple Function Practice
Swipe to show menu
Example of the function with arguments from the previous chapter
function.h
123456double convert_usd_to_eur(double usd_amount) { const double exchange_rate = 0.91; double euros = usd_amount * exchange_rate; return euros; }
Swipe to start coding
Create a function withdraw
that simulates a bank account withdrawal. It accepts the current balance and withdrawal amount as arguments. If the balance is sufficient, deduct the amount and return the new balance. Otherwise, return the original balance.
Solution
solution.cpp
Thanks for your feedback!