It is currently Sat May 18, 2013 6:39 pm
The Forum of Geeks and Nerds

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
string var;
cout << "Enter in a number:";
cin >> var;
cout << var;
system("PAUSE");
return 0;
}
ColdShadow wrote:
- Code: Select all
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
string var;
cout << "Enter in a number:";
cin >> var;
cout << var;
system("PAUSE");
return 0;
}
We can get input as a variable by using cin.

cheryl wrote:ColdShadow wrote:
- Code: Select all
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
string var;
cout << "Enter in a number:";
cin >> var;
cout << var;
system("PAUSE");
return 0;
}
We can get input as a variable by using cin.
I know next to nothing about C++.
Can you tell me the purpose of the iostream include? I've noticed that it must be present for even the simplest program.
And by the way, welcome to our forum : )


cheryl wrote: know next to nothing about C++.
Can you tell me the purpose of the iostream include? I've noticed that it must be present for even the simplest program.
iostream is a header file which is used for input/output in the C++ programming language. The name stands for Input/Output Stream. In C++ and its predecessor, the C programming language, there is no directly-included method for streaming data input or output. Instead, these are combined as a library. iostream handles basic input and output for C++, whereas stdio.h is used in C. iostream uses the objects cin, cout, and cerr for sending data to and from the standard streams input, output, and error respectively.

ColdShadow wrote:cheryl wrote: know next to nothing about C++.
Can you tell me the purpose of the iostream include? I've noticed that it must be present for even the simplest program.
I quote wikipedia:iostream is a header file which is used for input/output in the C++ programming language. The name stands for Input/Output Stream. In C++ and its predecessor, the C programming language, there is no directly-included method for streaming data input or output. Instead, these are combined as a library. iostream handles basic input and output for C++, whereas stdio.h is used in C. iostream uses the objects cin, cout, and cerr for sending data to and from the standard streams input, output, and error respectively.
iostream is only needed if the program uses cin, cout, or cerr

cheryl wrote:ColdShadow wrote:
Wow! So compared to a simple language like BASIC, which uses statements like "input x" or "print x" for input and output, C++ must be extremely customize-able. If I understand you correctly, there is no built in function for user input/output, you have to call up a pre-written subroutine to get that function? And iostream is one possible example of an input/output routine, yes?
Well, I can see why operating systems are written in this language...

ColdShadow wrote:cheryl wrote:ColdShadow wrote:
Wow! So compared to a simple language like BASIC, which uses statements like "input x" or "print x" for input and output, C++ must be extremely customize-able. If I understand you correctly, there is no built in function for user input/output, you have to call up a pre-written subroutine to get that function? And iostream is one possible example of an input/output routine, yes?
Well, I can see why operating systems are written in this language...
Iostream is a library of functions you can call.
Operating systems aren't programmed in c++ silly:)



Users browsing this forum: No registered users and 0 guests