HELP!!! Why my program doesn’t work ? C++/array | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 3

HELP!!! Why my program doesn’t work ? C++/array

https://code.sololearn.com/c6f7d2VXWVmB/?ref=app Why my program doesn’t work ? The task: Find all triples of numbers from the array A [n], which may be sides of a triangle.

21st Oct 2018, 11:24 AM
Maya
Maya - avatar
6 Antworten
+ 7
Just look at what the compiler warning says... You're using fancy quotation marks « / » instead of << / >>.
21st Oct 2018, 11:59 AM
Anna
Anna - avatar
+ 4
Ok. I found the error. It's pretty simple. You are using « in cout. That's causing a error sintax because the right way it's to use double < (in other words <<). For example: cout << "cout uses << and uses not « " << '\n';
21st Oct 2018, 12:05 PM
Anya
Anya - avatar
+ 2
Hum. I tested some more. In therms of syntax fells right. So i think it's a logical error. in this line: if ((ver1 + ver2 > ver3) && (ver1 + ver3 > ver2) && (ver2 + ver3 > ver1)) cout << ver1 << ver2 << ver3 << "write" << '\n'; } seems that you can never reach the condition for go inside the if. Can you explain me what you want to do with your code, please?
21st Oct 2018, 12:35 PM
Anya
Anya - avatar
+ 2
I’m sorry for my mistakes! I don’t know english very well. This program should find in the array all the triples of the element that will be the sides of the triangle be something
21st Oct 2018, 1:14 PM
Maya
Maya - avatar
+ 2
So i played with your code. And if i have understand right Is it something like this that you wants to achieve ? https://code.sololearn.com/cobwIYEg7Mfe/#cpp Inputs that i tested: // 3 7 9 15 // // 6 7 9 15 1 2 3 //
21st Oct 2018, 4:08 PM
Anya
Anya - avatar
+ 1
Oh, thanks! I fixed this error but the program still does not work correctly
21st Oct 2018, 12:14 PM
Maya
Maya - avatar