Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Simple Function Creation | Introduction
C++ Functions
セクション 1.  3
single

single

bookChallenge: Simple Function Creation

メニューを表示するにはスワイプしてください

タスク

スワイプしてコーディングを開始

You are building a ride-sharing app. Each ride has a distance in kilometers, and you want to calculate the total cost based on a base fare and a per-kilometer rate.

  1. Declare the function calculateTripCost that returns a double.
  2. Add a parameter to the function with type double named distance.
  3. Calculate the total cost by multiplying distance by perKmRate and adding the baseFare.
  4. Return the total cost from the function.

Do not modify the values of baseFare and perKmRate inside the calculateTripCost function.

解答

Switch to desktop実践的な練習のためにデスクトップに切り替える下記のオプションのいずれかを利用して、現在の場所から続行する
すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 1.  3
single

single

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

some-alt