+ 1
Why won't my code run??
So I made a code to find the least number from 1p numbers but when I run it says an error occurred and connection problem or something. I tried running other codes and they run just fine. https://code.sololearn.com/cbD60H4x667i/?ref=app
2 odpowiedzi
+ 5
You have to add this line, variables need to have a type:
int num1, num2, num3, num4, num5, num6, num7, num8, num9, num10;
+ 3
Based solely upon your errors below, and not the logic of your code, your main issue is that you didn't bother to declare more than half of your variables. You'll want to declare int num1 to num10. Also, you accidentally put a C as lowercase below when it should be uppercase.
ERROR MESSAGES:
..\Playground\: In function 'int main()':
..\Playground\:13:10: error: 'num1' was not declared in this scope
cin>>num1;
^
..\Playground\:14:10: error: 'num2' was not declared in this scope
cin>>num2;
^
..\Playground\:15:10: error: 'num3' was not declared in this scope
cin>>num3;
^
..\Playground\:16:10: error: 'num4' was not declared in this scope
cin>>num4;
^
..\Playground\:17:10: error: 'num5' was not declared in this scope
cin>>num5;
^
..\Playground\:18:10: error: 'num6' was not declared in this scope
cin>>num6;
^
..\Playground\:19:10: error: 'num7' was not declared in this scope
cin>>num7;
^
..\Playground\:20:10: error: 'num8' was not declared in this scope
cin>>num8;
^
..\Playground\:21:10: error: 'num9' was not declared in this scope
cin>>num9;
^
..\Playground\:22:10: error: 'num10' was not declared in this scope
cin>>num10;
^
..\Playground\:30:15: error: 'c' was not declared in this scope
else{num7=c;}