Я пытаюсь сделать что-то, что будет принимать строки ввода от пользователя, разделять их на строки в векторе, а затем печатать их по одной за раз (по 8 на строку).
пока это то, что я получил:
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
int main(void)
{
using namespace std;
vector<string> svec1;
string temp;
while(getline(cin, temp)) //stores lines of text in temp
{
if(temp.empty()) //checks if temp is empty, exits loop if so.
break;
stringstream ss(temp);
string word;
while(ss >> word) //takes each word and stores it in a slot on the vector svec1
{
svec1.push_back(word);
}
}
}
Я застрял на том, чтобы печатать их по 8 за раз, решения, которые я пробовал, продолжают выводить индекс из-за ошибок диапазона.