Az igazán kellemesen használható programozási nyelvekre emlékeztető módon is lehet használni a C++-t. Méghozzá egyenesen tömbbe olvasás
Forráskód:
#include <iostream>
#include <fstream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
ifstream beolvas("vau2.txt");
string temp;
int db=0;
while(!beolvas.eof()){
getline(beolvas,temp);
db++;
}
beolvas.close();
ifstream beolvas2("vau2.txt");
string csapat[db];
string jatekos[db];
for(int i=0;i<db;i++){
beolvas2>>csapat[i];
beolvas2>>jatekos[i];
}
beolvas2.close();
cout<<csapat[2]<<endl;
cout<<jatekos[2];
return 0;
}
Videó: