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

    Error, can't run

    I got this code sent to me, and am working with a friend to see what the problem is. We can't seem to run it at all the even try to find the problems with its errors.

    It just says the system cannot find the file specified. I was told to change something towards the beginning of the code to make it run at least, but still can't figure it out.

    This is the code

    Code:
    /*
    Mississippi has 11 characters
    First occurance of word "is" is at position: 1
    The first four characters are:          Miss
    The next two characters are:            is
    Charters start at position 9 are:       pi
    */
    
    #include  <iostream>
      #include <conio.h>
    
        using  namespace  std;
    
        int  main (  )
        {
        string  stateName = "Mississippi" ;
    
        cout  << stateName << " has " << length( ) << " characters\n";  
    
        cout  << "First occurance of word \"is\" is at position: " << find("is") <<  endl;
    
        cout << "The first four characters are:\t\t" << substr( 0, 4 ) <<  endl;
    
        cout << "The next two characters are:\t\t" << substr( 4, 2 ) <<  endl;
    
        cout << "Charters start at position 9 are:\t" << substr( 9, 5 ) <<  endl;
    
        _getch();
    	return 0 ;
    }

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Error, can't run

    Did you try to compile it? I got lots of errors. You need to #include <string> then define the undefined functions.

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Error, can't run

    We can't seem to run it at all the even try to find the problems with its errors.
    In such case you typically have some diagnostics from compiler. And I believe, this exercise is intended to give you some idea of solving this sort of issues.
    Best regards,
    Igor

  4. #4
    Join Date
    Jun 2012
    Posts
    5

    Re: Error, can't run

    any direction, or help would be great.

    I am at a loss with this one.

  5. #5
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Error, can't run

    Quote Originally Posted by C++Raven View Post
    any direction, or help would be great.

    I am at a loss with this one.
    Did you compile it?

    Viggy

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Error, can't run

    Quote Originally Posted by C++Raven View Post
    any direction, or help would be great.

    I am at a loss with this one.
    Are you blind?
    Or you just ignore the replies on your OP?

    Both GCDEF and Igor Vartanov wrote that you have to compile your code, get the compiler error messages and then try to fix the errors.
    What part of the task have you already done?
    Last edited by VictorN; June 5th, 2012 at 04:31 PM.
    Victor Nijegorodov

  7. #7
    Join Date
    Jun 2012
    Posts
    5

    Re: Error, can't run

    when I try to I get the error that says "system cannot find the file specified"

    I am trying to get it to compile first, so then I can start working out the other errors with it.

    But without being able to compile it I can't figure them out.

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Error, can't run

    Quote Originally Posted by C++Raven View Post
    when I try to I get the error that says "system cannot find the file specified"
    What line of your code produces this error?
    Victor Nijegorodov

  9. #9
    Join Date
    Apr 2010
    Posts
    172

    Re: Error, can't run

    Include WinSDK in the VC++ directories if you have it installed

  10. #10
    Join Date
    Jun 2012
    Posts
    5

    Re: Error, can't run

    Oh my god I finally realized what the problem is. . i had typed this code in another format, when I had thought that I was in .cpp this entire time.

    Sorry guys, what a stupid mistake, had me scratching my head not knowing what was going on.

    Thank You all for your input

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