I tried to introduce a cin.get instruction into a do-while and it didn't work.Can you help me?This is the actual code:
#include<string.h>
#include<iostream>
using namespace std;
int main()
{int n,b,i,j,k;
char a[100];
do{
cin.get(a,100);
n=strlen(a);
if(n<3)cout<<"Introduce a string with more than two digits!"<<endl;
}
while(n<3);
while(n>2 || n>1)
{for(i=0;i<=n-1;i++)
a[i]=a[i+1];
n=n-2;
for(k=0;k<=n-1;k++)
cout<<a[k];cout<<endl;}
return 0;
}
Only the do-whil instruction ins't working.The rest o fthe program does work.