std vs cout:
#include <iostream>
#include <string>
using namespace std;
int main()
{
std::string ends = "*****\n";
std::string mids = "* *\n";
std::cout << ends;
for (int i = 0; i < 3; i++)
std::cout << mids;
std::cout << ends;
}
1.)Can someone give me a little help to understand how this little program works;.
2.)Can couts be use where the std are?.
3.) I am using DEV C++ are there a better IDE compile or this one the best?
1 2
|
std::string ends = "*****\n";
std::string mids = "* *\n";
|
creates two strings, each with appropriate name and content
prints the ends string
1 2
|
for (int i = 0; i < 3; i++)
std::cout << mids;
|
prints mids three times
this prints out the end string
2.No.... COUT is basically a command, STD is a namespace, which tells the compiler where to find the COUT command.
3. There is no such thing as a "best" IDE, but popular ones are Visual Studio and Codeblocks.
Topic archived. No new replies allowed.