learning about strings

Posts 17 of 7 · Page 1 of 1
learning about strings
//My first time using strings

#include <stdfax.h>
#include <iostream>
#include <string>
using namespace std;

int main ()
{
string mystring = "this is a string";
cout << mystring;
return 0;

}

so im learning about strings and i want to know if it matters which order i put my file types (iostream stdfax string)
is there a specific order? or can i just put it in random

and also mystring = "This is a different string content";
cout << mystring << endl;
what does endl; mean?
what does it do
There is not really an order needed for a library unless one library needs content from the other one. (Includes)

Endl;means to give a new line.

cout << "test";
cout << "test";
would print:
testtest

cout << "test" << endl;
cout << "test":
would print:
test
test
Quote Originally Posted by CrypTology- View Post
//My first time using strings

#include <stdfax.h>
#include <iostream>
#include <string>
using namespace std;

int main ()
{
string mystring = "this is a string";
cout << mystring;
return 0;

}

so im learning about strings and i want to know if it matters which order i put my file types (iostream stdfax string)
is there a specific order? or can i just put it in random

and also mystring = "This is a different string content";
cout << mystring << endl;
what does endl; mean?
what does it do
It doesn't matter what order you put your include prepocessors in. They're programs from other locations on ur operating system that are run before the application is executed basically. Unlike functions the order they're run in won't affect the way the program runs.

endl; is pretty simple. Just makes a new line.


edit: i lose.
Quote Originally Posted by mookamoka3 View Post
They're programs from other locations on ur operating system that are run before the application is executed basically. Unlike functions the order they're run in won't affect the way the program runs.
This isn't true. Those libraries are part of your program. They will be linked to the compiled executable statically (at compile time) or dynamically (at run time). However each library has it's own set of dependencies. If it is using a library that has not been loaded yet it will load it itself either statically or dynamically as well. Your right in the fact that the order for the most part doesn't matter though, but they are not separate programs.
Quote Originally Posted by why06 View Post


This isn't true. Those libraries are part of your program. They will be linked to the compiled executable statically (at compile time) or dynamically (at run time). However each library has it's own set of dependencies. If it is using a library that has not been loaded yet it will load it itself either statically or dynamically as well. Your right in the fact that the order for the most part doesn't matter though, but they are not separate programs.
Hurray for accidental learning experiences.
Quote Originally Posted by CrypTology- View Post
//My first time using strings

#include <stdfax.h>
#include <iostream>
#include <string>
using namespace std;

int main ()
{
string mystring = "this is a string";
cout << mystring;
return 0;

}

so im learning about strings and i want to know if it matters which order i put my file types (iostream stdfax string)
is there a specific order? or can i just put it in random

and also mystring = "This is a different string content";
cout << mystring << endl;
what does endl; mean?
what does it do
One more thing from me. There's one rule for header files. Put your own headers in quotation marks and put it at the end e.g.:
Code:
#include<iostream>
#include<conio.h>
#include"game.h"
Posts 17 of 7 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?