Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A very simple program and It doesn´t work!Why?

Status
Not open for further replies.

juststarted

IS-IT--Management
Jul 6, 2004
4
GB
In VC++ standard edition tutorial,1.chapter
you´ll find this example.

#include<iostream>
using namespace std;
int main()
{
cout<<&quot;garden&quot;;
return 0;
}

I ll tell you steps just in case...First I would click on new file,gave a project a name,select win32 aplication,create an empty object aplication,open a new text file,written down the program,save it as ´name of project´.cpp,then I ll click ´insert file into a project´,then I ll use build comand and then execute command


The problem is that when I create a new project(I follow precicely the instructions
from tutorial)and try to use execute command a lot of times
it doesn´t work.Instead it writes that the file doesn´t exist and asks if I want to build it.Regardles if I click yes or no nothing happens.
Why is it that sometimes it works and sometimes not?
I recently removed VC++ from my computer.Could that be the reason?
Help would be greatly apriciated!
 
I couldn't figure out exactly what is wrong with your program from what you said, but if #include <iostream.h>(and subsequently removing #include <iostream>) doesn't help try removing &quot;using namespace std;&quot; from your code. I've found that I have problems using namespace std and using iostream. My problems seem to be MFC related but I'm not sure. It's worth a shot. Good Luck! MYenigmaSELF:-9
myenigmaself@yahoo.com
&quot;If debugging is the process of removing bugs, then programming must be the process of putting them in.&quot; --Dykstra
 
His code is correct - and will work in VC++. #include <iostream.h> is an essentially incorrect methodology for C++. #include <iostream> is the preferred method - the using directive means you don't have to qualify cout with std:: to resolve the namespace. I think your real problem is that you chose &quot;Win32 Application&quot; instead of &quot;Win32 Console Application&quot;. Try using the console application choice - see if that works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top