+ 1

[SOLVED] How to use code coach?

Hi, my problem is handling the multiple input of the test to verify my code, that is my functions are correct (when i copypaste my work in "my code" section with the test input I have the correct answer), but I don't know how the app gives input to my code and so what I have to write to pass It.

5th Jan 2020, 12:54 PM
Bobo
5 Respostas
+ 6
It is described in the coach description. Input format: Bla bla blaa Output format: Abla Babla
5th Jan 2020, 1:06 PM
Seb TheS
Seb TheS - avatar
+ 1
If you mean the description at each exercise I see It, but for example if as input I have a string and as output an integer, I write a code (function) with these requirement, if I don't give input inside the code at the test I have the error "no output", if I write the example of the description I have the correct relative result, let's Say 40, but ONLY IT, in the sense that the examples of the test don't give the correct output, but still 40 , that Is my code doesn't read the input from the tests, if I write an input(...) function once again I have an error (in the case above like "wrong output, the correct result Is 55 while yours Is "input(...)"" So I don't really understand how I'm supposed to receive the input of the 5 tests of the result section...
5th Jan 2020, 1:29 PM
Bobo
+ 1
Bobo Check out Popsicles, the inputs are already in the template, for all languages except Swift, in case you didn't overwrite them. You just need to type the rest of the code and outputs. Good luck!!!
5th Jan 2020, 4:01 PM
Mihai Apostol
Mihai Apostol - avatar
+ 1
[SOLUTION] Okay, seeing the Popsicles exercise helped me, probably requiring the input after the definition of the function was the problem, now I've requested the input at the beginning with the correct order and without writing any text in the input function and everything worked fine, thank you all for the help!!!
5th Jan 2020, 4:19 PM
Bobo
0
You get the input by using the standard input functions the language you are using provides. You didn't mention any language, so I'll assume C++ from your profile. For example, if the task states the input is a string, you declare a string and then ask for it: std::string s; std::cin >> s; And then you operate on that string whatever you are supposed to do. Another example, if you are supposed to take in a string and an int, you also ask for an int: std::string s; std::cin >> s; int i; std::cin >> i; And so on, you get the pattern. Same goes for the other languages.
5th Jan 2020, 3:55 PM
Shadow
Shadow - avatar