CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2009
    Posts
    8

    A program error plz help?

    A program for repeating a sentence for 250 times



    # include <iostream.h>

    # include <string.h>

    void main()

    { int x;

    cout<<"Could you please say that again?";

    for (x = 0; x < 250; x+1)

    {

    endl;

    }
    return;
    }

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: A program error plz help?

    Quote Originally Posted by jonahmano View Post
    A program for repeating a sentence for 250 times
    Your program does not compile.
    Code:
    Thank you for testing your code with Comeau C/C++!
    Tell others about http://www.comeaucomputing.com/tryitout !
    
    Your Comeau C/C++ test results are as follows:
    
    Comeau C/C++ 4.3.10.1 (Oct  6 2008 11:28:09) for ONLINE_EVALUATION_BETA2
    Copyright 1988-2008 Comeau Computing.  All rights reserved.
    MODE:strict errors C++ C++0x_extensions
    
    iostream.h, line 1: catastrophic error: #error directive:
              <iostream.h> is not a Standard header, use <iostream> instead.
              Note that when you change this header name, that identifiers such as
              "cout" and "endl" will no longer work, as they are in namespace
              "std", so use be "std::cout" and "std::endl" respectively.  See
              http://www.comeaucomputing.com/techtalk/#cnames for more details
      #error <iostream.h> is not a Standard header, use <iostream> instead.  Note that when you change this header name, that identifiers such as "cout" and "endl" will no longer work, as they are in namespace "std", so use be "std::cout" and "std::endl" respectively.  See http://www.comeaucomputing.com/techtalk/#cnames for more details
       ^
    
    1 catastrophic error detected in the compilation of "ComeauTest.c".
    Compilation terminated.
    
    In strict mode, with -tused, Compile failed
    The correct header is <iostream>, and main() returns int, not void.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Jul 2009
    Posts
    8

    Re: A program error plz help?

    So please send the correct programming steps so that I can practice

  4. #4
    Join Date
    Jun 2009
    Location
    oklahoma
    Posts
    199

    Re: A program error plz help?

    Code:
    #include <iostream>
    
    int main()
    { 
           int x;
           for (x = 0; x < 250; x++)
           {
                 std::cout<<"Could you please say that again?" << std::endl;
           }
    return 0;
    }
    Last edited by jnmacd; July 17th, 2009 at 11:56 PM. Reason: code tags

  5. #5
    Join Date
    Jul 2009
    Posts
    8

    Re: A program error plz help?

    what is

    x++

    std::cout

    return 0;

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured