Fun C++ Problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 69

Thread: Fun C++ Problem

Threaded View

  1. #15
    Join Date
    Jun 2002
    Location
    Moscow, Russia.
    Posts
    2,176

    Re: Fun C++ Problem

    VC++6 compiler was a lot faster (to fail on wrong code) - but still took 30 minutes on 1GHz machine. Result is that there are indeed only 3 solutions.
    Code:
    - at 24:
    int i, n = 20;
    for (i=0;-i<n; i--)
    {
    cout << "x" << endl;
    }
    
    
    + at 26:
    int i, n = 20;
    for (i=0; i+n; i--)
    {
    cout << "x" << endl;
    }
    
    
    n at 30:
    int i, n = 20;
    for (i=0; i<n; n--)
    {
    cout << "x" << endl;
    }
    Last edited by RoboTact; October 18th, 2006 at 06:53 PM.
    "Programs must be written for people to read, and only incidentally for machines to execute."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center