Dyskusje Q&A
#include <iostream>
using namespace std;
int sum(int a, int b=42) {
int result = a + b;
return (result);
}
int main() {
int x = 24;
int y = 36;
//calling the function with both parameters
int result = sum(x, y);
cout << result << endl;
//calling the function without b
result = sum(x);
cout << result << endl;
return 0;
}
why is da last function cout 66 and not 48 isn't it suppose to add 24+24?
1 Głos
6 odpowiedziwhat is tjis code problem!
#include <iostream>
using namespace std;
int main()
{
int b = 5;
int arr[b] = {11, 35, 62, 555, 989};
int sum = 0;
for (int x = 0; x < 5; x++) {
sum += arr[x];
}
cout << sum << endl;
return 0;
}
I cannot make an array using int variable in order to define array's element number!?
1 Głos
7 odpowiedziWher is mistake?
0 głosów
5 odpowiedziPopularne dzisiaj
C pointers
2 Votes
Python
1 Votes
Guys help please
0 Votes
Python question
2 Votes
Control flow
0 Votes
HTML
0 Votes
Front-end vs Full-stack
1 Votes
About our Capstone product "Ecocambio" We don't know how to code and how electronics would connect.
0 Votes
Are websites hackable?
1 Votes