Why the system is stopped working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
18th Nov 2019, 7:10 PM
Shofi Uddin
11 Answers
+ 2
https://code.sololearn.com/cu5dwLn7ESQq/?ref=app
18th Nov 2019, 7:46 PM
Shofi Uddin
+ 2
One example: Int item[n] variable n is not declared.
18th Nov 2019, 7:48 PM
Gevork Bagratyan
+ 1
Another example, you use cin to output text. When you should've used cout to output, then cin to input
18th Nov 2019, 7:49 PM
Gevork Bagratyan
+ 1
Int item [n] in declared in the loop isn't For (int i=0;i<n;i++>
18th Nov 2019, 7:51 PM
Shofi Uddin
+ 1
You declared i in that loop, and even then it is declared after the use of n and isn't even in the same scope.
18th Nov 2019, 7:54 PM
Gevork Bagratyan
+ 1
Once again, I suggest taking it slow and starting a new, more comprehensible project. Use new concepts bit by bit instead of smooshing it into one pile of spaghetti code that doesnt even function.
18th Nov 2019, 8:00 PM
Gevork Bagratyan
+ 1
I am trying now step by step One more clearify when I put int item[n] was two variable to declare right Example Int n; Int item; Like this right and then the loops
18th Nov 2019, 8:03 PM
Shofi Uddin
+ 1
Well, if you define int n; without any input or definition it will result in n being equal to NULL (I believe), so make sure to do that. Also make sure to make your code more readable by adding comments and indentations. Good luck with your project!
18th Nov 2019, 8:07 PM
Gevork Bagratyan
+ 1
https://code.sololearn.com/cF2jx4oe4owi/?ref=app I changed a bunch of the code so it works, you have to input the bar code, and if you want to input multiple bar codes you have to change the itemnum variable in the code. Sorry if it isn't exactly how you wanted it, but of course you can change it to your liking.
18th Nov 2019, 8:31 PM
Gevork Bagratyan
0
Wow there are alot things with this. First off use proper indentation, it makes your code much much more readable, second, you are defining are not declaring Char correctly it seems? As it is being read not as a variable but the char keyword, also many variables aren't even declared in your code. Some functions aren't even being used correctly, such as std::cin. I suggest creating an easier first project and taking things slow, try not to implement 20 different things at once if you dont know how to use them correctly. Good luck!
18th Nov 2019, 7:42 PM
Gevork Bagratyan
- 1
Char is new function but all other variable is already declared
18th Nov 2019, 7:47 PM
Shofi Uddin