+ 3
Functions with multiple parameters
what if i want to call function more than once...
12 Réponses
+ 16
it is on the course.
but let me give alternative function
#include <iostream>
using namespace std;
int multiply(int x, int y) {
int result = x * y;
return result;
}
int main() {
cout << multiply(3, 2)<<endl;
cout << multiply(5, 6);
}
/*output
6
30
*/
you can add more than 2 parameter.
+ 14
is the parameter contain only int
or int, float, string ?
+ 14
i have edited my answer above
+ 12
yes you can
+ 7
ah mei you are faster than me =w= ...
+ 4
You can call the function multiple times:
cout << multiply(5, 6); //outputs 30
cout << multiply(7, 3); //outputs 21 etc..
+ 3
how, give me an example by calling it twice
+ 3
only int
+ 3
c u wrote
int main(){
cout<<multiply(3,2)}
so similarly what if i want to add one more pair of number say (5,6) then how will i add
+ 3
thankx thats what i needed
+ 3
oh really sorry i didn't notice thanks alot
+ 3
plz c ma another doubt on srand