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.

Recommended Answers

All 11 Replies

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;
}

tag5,

Good morning. You are welcome in this nice forum. Your program source code must be surrounded with bb code tag. Read this How to use bb code tags?

sorry i don't now how to use it please reply,

sorry i don't now how to use it please reply,

Look at the link in adatapost's post :)

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

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;
}

It will only do this forever: output "x=.." and input a number

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

Yes -- you see those blue letters? That a link, just take your mouse and click on it.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.