تم الحل ✓
categoryهندسة الحاسبات
schoolبكالوريوس
event_available2026-07-14
السؤال
Transcribed Image Text:
QUESTION 1
What is the problem with the code snippet below?
void cost (int price, int reps)
{
for (int i = 0; i < reps; i++)
{
cout << price;
}
return;
int main()
{
cout << cost (10, 4) << endl;
return 0;
The function cost is invoked with the wrong parameters.
The function cost uses uninitialized variables.
The function cost returns void and therefore cannot be used in a cout statement.
The function cost must return an integer value.
QUESTION 2
What is the output of the following code snippet?
#include <iostream>
#include <string>
using namespace std;
int main()
{
int varl - 10%;
int var2 = 2;
int var3 = 20;
var3 var3 (varl var2);
cout << var3 << endl;
return 0;
0
4
20
There will be no output due to a run-time error.
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.