外国人の通人から送られてきたのですが問題文含めいまいちどんなソースコードを書いたらいいかわかりません。どなたかお時間ある方で教えていただけるとありがたいです。
引用テキスト。2つの同じタイプの参照パラメーターを受け取るasc_orderと呼ばれるテンプレートvoid関数。 2つの値の順序を確認し、必要に応じて値を交換します。 その結果、最初の参照変数には小さい値が含まれ、2番目の参照変数には大きい値が含まれます。関数の呼び出しを示すメイン関数。 値1と2を含むint変数を使用した最初の呼び出し。値4.0と3.0を含むdouble変数を使用した2番目の呼び出し。 値「world」および「hello」を含む文字列オブジェクトを使用した3番目の呼び出し。
引用テキストa template void function called asc_order that takes two same-type reference parameters; it checks the order of the two values and swap the values if necessary; the result is that the first referenced variable contains the smaller value and the second referenced variable contains the larger value. the main function that demonstrates the calls to the function. The first call with int variables containing values 1 and 2. The second call with double variables containing values 4.0 and 3.0. The third call with string objects containing values "world" and "hello".
回答2件
あなたの回答
tips
プレビュー