954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

a c++ solution

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.

tag5
Newbie Poster
10 posts since May 2009
Reputation Points: 8
Solved Threads: 0
 
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
Newbie Poster
10 posts since May 2009
Reputation Points: 8
Solved Threads: 0
 

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?

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

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

tag5
Newbie Poster
10 posts since May 2009
Reputation Points: 8
Solved Threads: 0
 
sorry i don't now how to use it please reply,


Look at the link in adatapost's post :)

tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
 

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

tag5
Newbie Poster
10 posts since May 2009
Reputation Points: 8
Solved Threads: 0
 
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;
}
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

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

prime1999
Newbie Poster
18 posts since Jul 2009
Reputation Points: 22
Solved Threads: 0
 
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.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 
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:

tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
 
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 butany 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 ???

csurfer
Posting Pro
568 posts since Jan 2009
Reputation Points: 485
Solved Threads: 88
 

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

tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You