So, until now I've read the string from keyboard using cin.get or cin.getline and then using a pointer to modifying every word like so:
p=strtok(string,' ');
but I've learned that I can read word by word such as:
char word[101];
cin>>word;
I am curious if I can find a stopping condition if I have an unknown number of words I've tried using:
while(cin>>word)
{
//condition
}
#include <iostream>
#include <cstring>
using namespace std;
char cuv[101],maxim[101]="nu exista",ok;
int main()
{
while(cin>>cuv) {
if(cuv[0]<=57 && cuv[0]>=48)
if(cuv[0]>maxim[0] || ok==0) {
ok=1; strcpy(maxim,cuv);
}
}
cout<<maxim;
return 0;
}