Read a sequence of words from cin and store the values a
vector. After you’ve read all the words, process the vector and change
each word to uppercase. Print the transformed elements, eight words to a
line.
Ho scritto il codice e funziona tutto tranne la parte del testo dell'esercizio in grassetto.
codice:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
vector<string> s;
cout<<"Scrivi delle parole"<<endl;
string z;
while(cin>>z)
s.push_back(z);
for(auto &c:s){
for(char &x:c)
x=toupper(x);}
int i=0;
for(auto &c:s)
{
++i;
if(i<=8){
cout<<c<<" ";
}
else{
cout<<'\n'<<c;
i=0;
}
}
}