+ 3

Functions with multiple parameters

what if i want to call function more than once...

16th Apr 2017, 9:23 AM
Shreya Parmar
Shreya Parmar - avatar
12 odpowiedzi
+ 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.
16th Apr 2017, 9:54 AM
Agus Mei
Agus Mei - avatar
+ 14
is the parameter contain only int or int, float, string ?
16th Apr 2017, 9:49 AM
Agus Mei
Agus Mei - avatar
+ 14
i have edited my answer above
16th Apr 2017, 10:01 AM
Agus Mei
Agus Mei - avatar
+ 12
yes you can
16th Apr 2017, 9:41 AM
Agus Mei
Agus Mei - avatar
+ 7
ah mei you are faster than me =w= ...
16th Apr 2017, 11:10 AM
Leon lit
Leon lit - avatar
+ 4
You can call the function multiple times: cout << multiply(5, 6); //outputs 30 cout << multiply(7, 3); //outputs 21 etc..
16th Apr 2017, 10:01 AM
h8c
h8c - avatar
+ 3
how, give me an example by calling it twice
16th Apr 2017, 9:42 AM
Shreya Parmar
Shreya Parmar - avatar
+ 3
only int
16th Apr 2017, 9:49 AM
Shreya Parmar
Shreya Parmar - avatar
+ 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
16th Apr 2017, 9:56 AM
Shreya Parmar
Shreya Parmar - avatar
+ 3
thankx thats what i needed
16th Apr 2017, 10:02 AM
Shreya Parmar
Shreya Parmar - avatar
+ 3
oh really sorry i didn't notice thanks alot
16th Apr 2017, 10:04 AM
Shreya Parmar
Shreya Parmar - avatar
+ 3
plz c ma another doubt on srand
16th Apr 2017, 10:05 AM
Shreya Parmar
Shreya Parmar - avatar