2
How to make a array of objects? I am trying but am not succeeding, returns me an error:
line 26 [Error] no match for 'Operator[]' (operand types are 'Time' and 'int')
Code:
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
#include "Time.h"
using namespace std;
int apaga_espaco(ifstream &tab, Time t)
{
string nome="gremio";
int saldo=0;
int vit=1,i;
string s;
char N;
while (tab.good())
{
i++;
getline(tab, s);
s.erase(0,29);
N=s.find(':');
s.erase(0,N+6);
return 0;
t[i].set_name(nome);
}
}
int main()
{
Time *t;
t=new Time[20];
ifstream tabe;
char N;
string s;
tabe.open("Tabela.txt", ios::in);
if (!tabe.is_open())
{
cout << "Arquivo nao encontrado, erro fatal!";
exit(1);
}
apaga_espaco(tabe,*t);
}
sorry I made a mistake at the time of dialing, already fixed.
– Roger Amaro Almeida
No problem. Now you can vote for anything you want on the site. Remember that voting is not the same thing as accepting it. Voting is not exclusive. You can give anything you want, even in other questions.
– Maniero