0

C++Functions problem

I follow all rules in code but every time chatbot said try again

27th Jan 2025, 3:48 PM
Roshni Vishwakarama
Roshni Vishwakarama - avatar
2 odpowiedzi
+ 3
Roshni Vishwakarama , without having seen your code we cannot see what the issue is. please put your code in playground, save it, create a link to the code file and post this link here.
27th Jan 2025, 4:34 PM
Lothar
Lothar - avatar
+ 1
When writing a function in c++ you should always follow a certain ruleset: 1. Your function's name should only start from latin letters(a-z) or underscore 2. Your function should follow C++ syntax template: return_type function_name() { //body of the function //return; } Where return_type must be specified and have a type what exists in c++ i. e types like: int, float, std::bool or user defined types.(UDT's). If return_type is void return keyword is optional as function does not return a value. In parenthesis - (), you can specify parameters for you function which follow same naming rules as variables and fumctions. You should also check your function definition and place where you calling the function because C++ is case sensitive. For example given code: void Foo() {} foo(); Will give an error as Foo and foo functions are not the same thing.
27th Jan 2025, 7:36 PM
Lazy Dev
Lazy Dev - avatar