You operate a mobile provider running a promotion that multiplies a user’s internet bandwidth.
Fix the program by completing the function and calling it, so that the given megabyte outputs before and after the promotion work correctly.
The multiplier is taken as input inside the multiplier function.
Sample Input
5
2
Sample Output
Before the promotion: 5
After the promotion: 10
Explanation
The first input is the count of megabytes, the second is multiplier.
The first outputted line represents the count of megabytes before the function-multiplier call, and the second one - after.
//my code
#include <iostream>
using namespace std;
//Created by Liu Chong on 2021/07/15
/*complete the function to multiple the megabytes*/
int promotion(int *m,int n) {
//taking multiplier as input
int multiplier;
cin>>multiplier;
*m=multiplier*n;
//cout<<*m<<endl;
}
int main() {
//getting initial count of megabytes
int megabytes;
cin >> megabytes;
//printing the count of megabytes
cout << "Before the promotion: " << megabytes << endl;
//complete the function call
promotion(&megabytes,megabytes);
//printing the count of megabytes after the promotion
cout << "After the promotion: " << megabytes<< endl;
return 0;
}

本文介绍如何修复并完善一个手机运营商的促销代码,通过输入的倍增器正确调整用户的网速。提供了一个示例输入和输出,以及完成的`promotion`函数调用,确保了带宽在促销前后计算的准确性。
2261

被折叠的 条评论
为什么被折叠?



