|
-
June 5th, 2012, 03:44 PM
#1
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 ;
}
-
June 5th, 2012, 03:47 PM
#2
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.
-
June 5th, 2012, 04:04 PM
#3
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
-
June 5th, 2012, 04:22 PM
#4
Re: Error, can't run
any direction, or help would be great.
I am at a loss with this one.
-
June 5th, 2012, 04:24 PM
#5
Re: Error, can't run
 Originally Posted by C++Raven
any direction, or help would be great.
I am at a loss with this one.
Did you compile it?
Viggy
-
June 5th, 2012, 04:28 PM
#6
Re: Error, can't run
 Originally Posted by C++Raven
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
-
June 5th, 2012, 04:28 PM
#7
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.
-
June 5th, 2012, 04:30 PM
#8
Re: Error, can't run
 Originally Posted by C++Raven
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
-
June 5th, 2012, 04:40 PM
#9
Re: Error, can't run
Include WinSDK in the VC++ directories if you have it installed
-
June 5th, 2012, 04:54 PM
#10
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|