Termination of loops.

I am making a prog to accept a character and display four successive characters. At present i am able to accept and display all the characters after the entered character. Pls help :) Thanx in advance.

// Just Rahul Prog-7
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
char a;
cout<<"Enter a charcter=";
cin>>a;
cout<<"Successive four charcters are=";
for(;a++;a<=4)
{
cout<<a<<",";
}
getch();
}
You have your for-loop arguments swapped. You need to make a secondary variable so you know when you are 4 characters after the original.
Last edited on
Thanks but could you show this to me as code.
int b = a;
Topic archived. No new replies allowed.