Task:
Write a program that given an input value 'N' displays 'N' rows of the form 12....N, 23....N+1, and so on - a barber poll pattern of numbers.
As an example if the number 5 was entered, the program should display:
12345
23456
34567
45678
56789
Once the program is running, ask the user if they want to do it again.
so what I have done is this..
PHP Code:int main(void)
{
int user_input = 0;
cout << "Please enter a number: "<< endl;
cin >> user_input;
for(int i=1;i<=user_input;i++)
{
for(int j=i;j<(user_input+i);j++)
{
cout<<j;
}
cout <<"\n";
}
getch();
return 0;
}
Then I realized in the program description it said "use multiple if statements" so now I've been at a stand still for 2 days, can someone help me correct this code? I would appreciate it greatly, thanks


LinkBack URL
About LinkBacks
Reply With Quote