🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

C++ Workshop - Getting Started with C++ (Ch. 1 & 2)

Started by
182 comments, last by Dbproguy 16 years, 2 months ago

Setup Visual C++.NET Windows Console Project



1. Run Visual Studio. NET program

"This image hosted by imageshack.us"

2. Click on File>New>Project menu

"This image hosted by imageshack.us"

3. Choose "Visual C++ Project" and "Win32 Console Project" then name your own project

"This image hosted by imageshack.us"

4. Click on "Application Setting" and Select "Empty project"

"This image hosted by imageshack.us"

5. Right click on Source file and Add>Add New Item...

"This image hosted by imageshack.us"

6. Choose "C++ File (.cpp)" and name the file then Click Open button

"This image hosted by imageshack.us"

Have fun!
DinGY
Yesterday is history.Tomorrow is a mystery. Today is a gift"
Advertisement
Quote: Original post by jflanglois
Well, the organizer has suggested Microsoft Visual C++ 2005 Express Edition. Look here for information about the workshop.

The STL is the "Standard Template Library" and it is a collection of utilities that are part of the C++ language and that make your life easier. std::cout is a part of the STL, for instance.


jfl.


Without wishing to get too pedantic on a workshop thread, the STL actually refers to Hewlett Packards 1995 "Standard Template Library" (available here). Most of it was adopted into the C++ Standard, and some of its techniques were later applied to other C++ components such as the IOStream library and strings.

std::cout is actually part of the IOStream component of the C++ Standard Library, not the STL component.

The STL and the C++ Standard Library are not synonymous terms, though a lot of people tend to (incorrectly) treat them as such.

Isn't it possible to have an own section on the forum for this workshop? When it gets advanced these posts are gona get huge! And if someone has a problem its easyer to brows the topics that could relate to the same problems instead of looking trough a post with 40 pages..
There is one :)

go here;

and scroll all the way down
Thanks a lot. Week 1 starts and I am finally able to write program in Dev-c++.
Hello program, adding numbers. I din't know about srd:: and no .h in header file like in iostream.h. But I guess Dev is highly rated compiler.

"\n and endl" are different[totally]. What is flush.
Quote: Original post by kimi
I din't know about srd:: and no .h in header file like in iostream.h. But I guess Dev is highly rated compiler.


Dev-C++ is an IDE. g++ is the compiler. iostream.h is an old header dating from before C++ was standardized. Some C++ compilers still include it for backward compatibility, but it is not part of the standard C++ library.

Quote: "\n and endl" are different[totally]. What is flush.


As others have pointed out, when you write something to a stream the data isn't generally sent immediately, for efficiency purposes. If you were to write to a file and you had a file access every time you write even a single character, your system would slow to a crawl. So instead, when you write to a stream, the data is placed in a buffer and when that buffer is full, all the data it contains is sent to the device (file, screen, whatever). Flushing forces this transfer.

'\n' is the newline character. endl is a stream manipulator that writes a newline and then flushes the buffer.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Well I though this was suppose to be a C++ 6.0 workshop!!!
I'm using Borland C++, Here's my Code:

#include <iostream.h>
#include <dos.h>

int main()
{
int x = 5;
int y = 7;
cout << "\n";
cout << (x + y) << " " << (x * y);
cout << "\n";

sleep(5);
}

Darn man, I have microsoft visual studio .net 2003 on my laptop. But I don't know how to use it. Secondly, do I need visual studio 2005 express edition?
I Have Awoken.
Quote: Original post by Nanook
Isn't it possible to have an own section on the forum for this workshop? When it gets advanced these posts are gona get huge! And if someone has a problem its easyer to brows the topics that could relate to the same problems instead of looking trough a post with 40 pages..


Nanook,

There is a separate forum as someone pointed out. And we will have 1 thread per week (approximately 15-20 threads when the workshop is over). The weeks divide topics by chapter(s), so it should be relatively easy to find which thread you should use to ask and answer questions.

I do suspect that most threads will still have 100+ posts, but chances are good if someone had a question, someone else will have the same question. I encourage you to "follow" the threads rather than just popping in occasionally to ask a question. Chances are good your question will have been answered in a previous post.

Once I get some moderator privileges in this forum I'll try and remove clearly duplicate posts to cut down on the number of posts. With so many people reading this thread (thousands per day), and the number of posts growing in the 100's in later chapters, I want the threads to read like a relatively clean dialog of questions, answers, and small debates. Running commentaries or discussions will probably be moved out of they become no longer applicable to the topic.

Also, I encourage everyone to ask/answer questions as they arise, but keep in mind that the first two chapters are to a degree an "overview" of the language. Much of what you're seeing will be more fully explained in the chapters to come. So if you ask a question and get "That'll be explained in a few weeks," that just means we don’t want to trouble you with too much information all at the beginning. There's a natural order in which to learn a language, and trying to learn some things to early can make things more confusing.

In general, however, feel free to ask your questions, we'll let you know if the answer is best served at a later date.

Cheers!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Quote: Original post by kaydash
Well I though this was suppose to be a C++ 6.0 workshop!!!
I'm using Borland C++, Here's my Code:

#include <iostream.h>
#include <dos.h>

int main()
{
int x = 5;
int y = 7;
cout << "\n";
cout << (x + y) << " " << (x * y);
cout << "\n";

sleep(5);
}

Darn man, I have microsoft visual studio .net 2003 on my laptop. But I don't know how to use it. Secondly, do I need visual studio 2005 express edition?



Kaydash,

Visual Studio 6 was not very compliant with the ISO standard, as such, there is some syntax that's incorrect. I'm not as familiar with Borland, but depending upon your version, it too may be out-dated.

From your example, <iostream.h> is non-standard and should be avoided. The correct method is just <iostream>. If you put that in your compiler/IDE and it does not recognize it, then yes, you will need a new compiler.

If you check the "C++ Workshop - Introduction" thread you will find a link to where to download Visual C++ 2005 Express Edition. I encourage you to do so.

Cheers!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Quote: Original post by jwalsh
Quote: Original post by Nanook
Isn't it possible to have an own section on the forum for this workshop? When it gets advanced these posts are gona get huge! And if someone has a problem its easyer to brows the topics that could relate to the same problems instead of looking trough a post with 40 pages..


Nanook,

There is a separate forum as someone pointed out. And we will have 1 thread per week (approximately 15-20 threads when the workshop is over). The weeks divide topics by chapter(s), so it should be relatively easy to find which thread you should use to ask and answer questions.

I do suspect that most threads will still have 100+ posts, but chances are good if someone had a question, someone else will have the same question. I encourage you to "follow" the threads rather than just popping in occasionally to ask a question. Chances are good your question will have been answered in a previous post.

Once I get some moderator privileges in this forum I'll try and remove clearly duplicate posts to cut down on the number of posts. With so many people reading this thread (thousands per day), and the number of posts growing in the 100's in later chapters, I want the threads to read like a relatively clean dialog of questions, answers, and small debates. Running commentaries or discussions will probably be moved out of they become no longer applicable to the topic.

Also, I encourage everyone to ask/answer questions as they arise, but keep in mind that the first two chapters are to a degree an "overview" of the language. Much of what you're seeing will be more fully explained in the chapters to come. So if you ask a question and get "That'll be explained in a few weeks," that just means we don’t want to trouble you with too much information all at the beginning. There's a natural order in which to learn a language, and trying to learn some things to early can make things more confusing.

In general, however, feel free to ask your questions, we'll let you know if the answer is best served at a later date.

Cheers!


If you're willing to go to the trouble, you could always add links to questions/answers to the first post.

This topic is closed to new replies.

Advertisement