VS 2010 C++

Hello , Im new member here and i have one question.
on my VS 2010 i wrote a simple code but it didnt debug!! and there is an error message if i pressed Ctrl+F5 "file name" is not recognized as an internal or external command , operable program or batch file.
and if i pressed F5 only it says
"the file name"
the system cannot find the file specified.
what should i do??
Could we get some "complete but minimal code"?
yup! if i typed
<
void main()
{
cout<<"David"<<endl;
}
>
the code is done! but if i write a code includes if or for loop or switch the code output is still David o.O
Last edited on
my windows is xp sp3 and i use Visual studio 2010
Note: i didn't type system("pause") but the window didn't hide.
i also didnt make the linker "NO" and the code is done!!!!
I think you misunderstood, just paste the whole code in here I suppose. Make sure to use code tags.
<
#include <iostream>
using namespace std;
int main()
{
for(int i=1;i<=100;i++)
cout<<i<<endl;
system("pause")
return 0;
}
>
the result is an error message
Unable to start program 'file path'
The system cannot find the file specified
but if i wrote a simple code like that
<
#include <iostream>
using namespace std;
int main()
{
cout<<"David"<<endl;
system("pause")
return 0;
}
>
and pressed Ctrl+F5 its output is David :/
Last edited on
file name.exe is not in the Debug folder
In both snippets, you're missing the ; after system("pause").
Neither snippet will compile.

If I add the missing ; the first code compiles and runs correctly, displaying numbers from 1 to 100.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
http://v2.cplusplus.com/articles/jEywvCM9/
It makes it easier to read your code and it also makes it easier to respond to your post.
Hint: You can edit your previous post, highlight your code and press the <> formatting button.


Last edited on
AbstractionAnon :
nothing new! i made the ; after system("pause") it also doesn't work !!
I don't know what else to tell you. After making the correction I mentioned, the code compiles and runs correctly for me.

1
2
3
4
5
6
7
8
9
#include <iostream>
using namespace std;

int main()
{   for(int i=1;i<=100;i++)
        cout<<i<<endl;
    system("pause");
    return 0;
}
1
2
3
[snip]
97
98
99
100
Press any key to continue . . .


Perhaps your project settings are not correct in Visual Studio. Try creating a new project.

the problem is not in the code syntax , bro .... it is in the program itself or my computer :/
Your best bet would be to make a new project. I can't tell you what is happening, you might have tinkered with the project dir and/or changed some projects settings.

Make a new project and report back.
Topic archived. No new replies allowed.