Re: [C++][Help]Using Cout
Code:
//Listing 2.2 using cout
#include <iostream>
using namespace std;
int main()
{
cout << "Hello there.\n";
cout << "Here is 5: << 5 << "\n";
cout << "The manipulator endl writes a new line to the screen.";
cout << endl;
cout << "Here is a very big number:\t" << 70000 << endl;
cout << "Here is the sum of 8 and 5:\t" << 8+5 << endl;
cout << "Here’s a fraction:\t\t" << (float) 5/8 << endl;
cout << "And a very very big number:\t;
cout << (double) 7000 * 7000 << endl;
cout << "Don't forget to replace Jesse liberty with your name...n\";
cout << "Christopher Gissberg is a C++ programmer!\n";
return 0;
}
Try that.
Re: [C++][Help]Using Cout
Use
using namespace std;
after the include.
You forgot an quote here: "Here is 5:" <<
And its better to put ( and ) around equations.
Re: [C++][Help]Using Cout
Fixed it myself xD But thanks for the help, here's the result :
[CODE]//Listing 2.2 using cout
#include <iostream.h>
int main()
{
cout << "Hello there.\n";
cout << "Here is 5:" << 5 << "\n";
cout << "The manipulator endl writes a new line to the screen.";
cout <<
endl;
cout << "Here is a very big number:\t" << 70000 << endl;
cout << "Here is the sum of 8 and 5:\t" << 8+5 << endl;
cout << "Here
Re: [C++][Help]Using Cout
#include <iostream.h>
is the same as doing
# include <iostream>
# using namespace std;
the .h does it ;)
Re: [C++][Help]Using Cout
#include <iostream.h> has been deprecated for many years now, you shoudn't use it anymore. You don't have to write "using namespace std;" because classes in the deprecated headers are not in any namespace, they are in global scope. This changed with the new header files, which define everything in the namespace std. Only these new headers belong to the C++ standard
Re: [C++][Help]Using Cout
Ok heres a sample.....
Code:
#include <iostream>
#using <System.dll>
using namespace std;
using namespace System;
using namespace System::Diagnostics;
int WinAPI Main()
{
cout << " This is a standard Line Output followed by endl which ends the line" << endl;
cout << " Now we will launch a Program pointing to this thread but in another section " << endl;
LaunchRagezone();
}
void LaunchRagezone(void)
{
Process^ LaunchRage = gcnew Process;
LaunchRage->StartInfo->FileName = "iexplore.exe";
LaunchRage->StartInfo->Arguments = "http://forum.ragezone.com/f144/c-help-using-cout-346537/";
LaunchRage->Start();
cout << " Ragezone thread opened ! << endl;
RZCodeHelp();
}
void RZCodeHelp(void)
{
Process^ RZCodeHelp = gcnew Process;
RZCodeHelp->StartInfo->FileName = "iexplore.exe";
RZCodeHelp->StartInfo->Arguments = "http://forum.ragezone.com/f144/";
RZCodeHelp->Start();
cout << " Ragezone Code Helper forum opened ! " << endl;
RZGunz();
}
void RZGunz(void)
{
Process^ RZGunz = gcnew Process;
RZGunz->StartInfo->FileName = "iexplore.exe";
RZGunz->StartInfo->Arguments = "http://cp.rzgunz.com";
RZGunz->Start();
cout << " RZGunz Website Opened ! Opening RZ Lineage next " << endl;
RZL2();
}
void RZL2(void)
{
Process^ RZL2 = gcnew Process;
RZl2->StartInfo->FileName = "iexplore";
RZl2->StartInfo->Arguments = "http://lineage.ragezone.com/l2";
RZl2->Start();
cout << " Started Ragezone Lineage site. And yeh I was bored " << endl;'
n2();
}
void n2(void)
{
cout << " I Was bored so I wrote this program thanks =P" << endl;
}
Side note : I Can use System(" "); to start programs I know that. I just prefer to do it the way I was taught.