私はこのようなテキストファイルを持っています
Path
827 196
847 195
868 194
889 193
909 191
929 191
951 189
971 186
991 185
1012 185
Path
918 221
927 241
931 261
931 281
930 301
931 321
927 341
923 361
921 382
getline関数を使用してテキストファイルのすべての行を読み取っています。1行の2つの数値を2つの異なる整数変数に解析したいと思います。これまでのコードはです。
int main()
{
vector<string> text_file;
int no_of_paths=0;
ifstream ifs( "ges_t.txt" );
string temp;
while( getline( ifs, temp ) )
{
if (temp2.compare("path") != 0)
{
//Strip temp string and separate the values into integers here.
}
}
}