4 Answers
+ 2
Default values can only be placed on latter parameters, e.g. func(int a, int b = 42). You don't have data type for the second parameter. To print 2 strings, use cout << string1 << string2;
17th Jan 2021, 11:12 AM
ä½ ēŸ„é“č¦å‰‡ļ¼Œęˆ‘也ę˜Æ
ä½ ēŸ„é“č¦å‰‡ļ¼Œęˆ‘也ę˜Æ - avatar
+ 2
zaya1235 CarrieForle just said, "default values can only be placed on latter parameters". Example: func(int a, int b = 1) is valid, but func(int b = 1, int a) is invalid For the same reason, you code is invalid. void printOrder(string hisOrder, string my="Black tea") is valid, but your function definition is invalid.
17th Jan 2021, 11:28 AM
XXX
XXX - avatar
0
CarrieForle so it should be like this void printOrder(string my="Black tea", string hisOrder ) { cout << my << hisOrder ; }
17th Jan 2021, 11:23 AM
zaya1235
zaya1235 - avatar
0
CarrieForle XXX thank youšŸ‘ļøšŸ’‹šŸ‘ļø
17th Jan 2021, 11:33 AM
zaya1235
zaya1235 - avatar