I would like to read my text file and output it exactly like in the input but the thing is, they are repeated! and the number will be either 1 or 0
My c++ code
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int n, count, size = 10;
string name, ID, stamina, plusmode, type;
int main ()
{
ifstream data;
data.open("cards2.txt");
while (data)
{
data >> n;
getline (data, name, '\t');
getline (data, ID, '\t');
getline (data, stamina, '\t');
getline (data, plusmode, '\t');
getline (data, type, '\t');
for (count = 1; count <= 10; count++)
{
cout << n << " " << name << " " << ID << " " << stamina << " " << plusmode << " " << type << endl;
}
}
}
My txt file
1 Abyss Devolos F0647 Balance NA SpeedStorm
2 Ace Dragon E7609 Attack NA HyperSphere
3 Anubion A2 E1057 Defense NA Dual-Layer
4 Balar B4 E4726 Attack NA SlingShock
5 Crystal Dranzer F0217 Balance NA Burst
6 Cyclone Belfyre F3965 Stamina Attack QuadDrive
7 Dark-X Nepstrius E4749 Defense NA SlingShock
8 Diomedes D2 E1062 Attack NA Dual-Layer
9 Doomscizor E1033 Attack NA SwitchStrike
10 Vatryek Wing Accel B9492 Attack NA Burst
My output in terminal
1 Abyss Devolos F0647 Balance
1 Abyss Devolos F0647 Balance
1 Abyss Devolos F0647 Balance
1 Abyss Devolos F0647 Balance
1 Abyss Devolos F0647 Balance
1 Abyss Devolos F0647 Balance
1 Abyss Devolos F0647 Balance
1 Abyss Devolos F0647 Balance
1 Abyss Devolos F0647 Balance
1 Abyss Devolos F0647 Balance
0 Abyss Devolos F0647 Balance
0 Abyss Devolos F0647 Balance
0 Abyss Devolos F0647 Balance
0 Abyss Devolos F0647 Balance
0 Abyss Devolos F0647 Balance
0 Abyss Devolos F0647 Balance
0 Abyss Devolos F0647 Balance
0 Abyss Devolos F0647 Balance
0 Abyss Devolos F0647 Balance
0 Abyss Devolos F0647 Balance
Please help me. I dont know how to make it not repeated