Good, morning every one, in this nice forum;

I solved a c++ solution but i don't understand the idea of the program,
so i need help to understand the steps and the use of this program.
Thankyou,
all.

main()
{
    int x,n, count=0;

           n=n+1
nxt:    cout<<"x=..";
          cin>>x;
     if(x>60)
          count=count+1;
     if(n==10)
          cout<<count;
     else 
          goto nxt;
}

Look at the link in adatapost's post???

BB code tags : Wrap up your source code with code tags. You see the # icon at toolbar with post editor.
Or Read this - How to use code tag?

int main()
{
    int x,n, count=0;
    n=n+1;
   nxt: cout<<"x=..";

   cin>>x;
   if(x>60)
          count=count+1;
   if(n==10)
          cout<<count;
  else 
         goto nxt;
}

Look at the link in adatapost's post???

Do you know how to use a computer? (I hope so)
Do you know what 'internet' is? (I hope so)
If you can answer yes to both of these questions, then try to answer the following question:
Do you know what a link is? (On this forum links are marked in blue, and when you move your mouse pointer over it, it will be underlined)
Just click on it, and your browser (this is the program on your computer that you use to display webpages, with you this is probably called: 'Internet Explorer') will display a new web page.
Then you start reading this web page.

>I solved a c++ solution but i don't understand the idea of the program,
so i need help to understand the steps and the use of this program.

So, you're saying you solved it, but you don't understand your own solution?
Strange :icon_rolleyes:

main()
{
    int x,n, count=0;

           n=n+1
nxt:    cout<<"x=..";
          cin>>x;
     if(x>60)
          count=count+1;
     if(n==10)
          cout<<count;
     else 
          goto nxt;
}

You really sure that this is a code ??? Because I don't see any thing that this program can do... All I see is C++ being used. Not only you but any sensible person might find this program totally senseless...Its really hard even for us to know its LOGIC. Nothing is connected over here it is testing something which is never set and never even dealt with.Just loops around random number of times.

What did you really write this program for ???

To the OP:
How do you think variable n will ever get value 10 ?
You never explicitly put a value in it.

n will never become ten, so you can rip this out of your code, and it will work in exactly the same way.

if(n==10)
    cout<<count;

>Its really hard even for us to know its LOGIC.
The LOGIC is: there's no LOGIC :P

This article has been dead for over six months. Start a new discussion instead.