+ 1

What type functions do I need to use in c++?

I learning c++ new programmes I have barcode and price of the item. I need to make project when the users put a barcode the price will come on total. Examples I made like this Int barcode[10]; Barcode[0]= 0121; Double price[10]; Price[0]=6.20; Total=0; Then I done for loop For( int i = 0; i<10;i++ { Cout<<enter barcode>>endl; Cin>>barcode[i] ; } I can type the barcode but it doest refers to price I can only type the barcode but doesn't refer to price. I want the result is when the users enter barcode many time 0121 0121 Total should be 6.20 6.20 = Total =12.40 I need help please for this to learn

12th Nov 2019, 7:33 PM
Shofi Uddin
2 ответов
+ 1
It seems that you are taking in input and storing it in barcode[i]. Sorry if i am wrong as i dont know much about c++. However, try storing the input in a variable, say 'barIn' and using if-else check which barcode it refers to. This way using that barcode's index you can print the price.
14th Nov 2019, 1:21 PM
Anirudh Sharma
Anirudh Sharma - avatar
+ 1
Can you share your code?
14th Nov 2019, 1:22 PM
Anirudh Sharma
Anirudh Sharma - avatar