У меня есть этот журнал вызовов, состоящий из времени суток и продолжительности данных в файле:Импорт раз из текстового файла в C++
Mo 12:30 16 Ту 7:15 10 Мы 9:10 20 Th 15:34 6 Fr 13:12 8
Я хочу хранить эти данные в переменных так, но у меня возникают проблемы из-за двоеточий.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream inputfile;
string day;
double time;
int hours;
string semicolon;
int minutes;
int timeSpent;
inputfile.open("Data.txt");
inputfile >> day;
cout << day << endl;
inputfile >> hours;
cout << hours << endl;
inputfile >> semicolon;
cout << semicolon << endl;
inputfile >> minutes;
cout << minutes << endl;
inputfile >> timeSpent;
cout << timeSpent << endl;
return 0;}
Лечить точкой с запятой [как символ] (http://cpp.sh/8kxa) не строку. – crayzeewulf
Спасибо вам большое! – Y3DII