I want to put all of the data in my .txt file to the program to run but my problem is, it outputs only the first two data in my txt file. The rest, it doesn't read.
Assassin's Creed IV:Black Flag /*only this two
29.99 outputs*/
Murdered: Soul Suspect
13.49
Middle-earth: Shadow of Mordor Legion Edition
49.99
Tomb Raider Digital Edition
9.99
Brothers: A Tale of Two Sons
3.00
InFaMOUS Second Son
39.99
Grand Theft Auto V
59.99
The Last Of Us Remastered
49.99
The Walking Dead: The Complete First Season
19.99
Outlast: Bundle of Terror
28.99
PT
0.00
Line 40 reads the price, but not the newline character. The second time through the loop line 39 reads the newline and line 40 attempts to read a number but fails. After that none of the reads succeed.
Add cin.ignore( numeric_limits<streamsize>::max(),'\n'); after line 40. This will read and discard all characters through the first newline. You may also need to add #include <limits> at the beginning to pick up numeric_limits<>