Visual C++ 2003 (Visual Studio 2003) How to compile?

Hello folks,

I'm new to C++ and wanting to self teach everything. Here is my problem, I am using Visual Studio 2003, full version. I have downloaded a file for a C++ tutorial from this site.

[hr]

[code]
// Chapter 1 - Program 1

#include /* This is the stream definition file */

void print_it(const int data_value);

main()
{
const int START = 3; // The value of START cannot be changed
const int STOP = 9; // The value of STOP cannot be changed
volatile int CENTER = 6; /* The value of CENTER may be changed
by something external to this
program. */
int index; /* A normal C variable */

for (index = START ; index < STOP ; index++)
print_it(index);
} /* End of program */


void print_it(const int data_value)
{
cout << "The value of the index is " << data_value << "
";
}




// Result of execution
//
// The value of the index is 3
// The value of the index is 4
// The value of the index is 5
// The value of the index is 6
// The value of the index is 7
// The value of the index is 8


[/code]
[hr]

I double click this and open this .cpp per the instructions, but with the window that it opens in I cannot find a way to compile it and see the results as the instructions state. I am curious if anyone familiar with the software can direct me to how to make it compile so I can begin learning C++? :)

Comments

  • : Hello folks,
    :
    : I'm new to C++ and wanting to self teach everything. Here is my problem, I am using Visual Studio 2003, full version. I have downloaded a file for a C++ tutorial from this site.
    :
    : [hr]
    :
    : [code]
    : // Chapter 1 - Program 1
    :
    : #include /* This is the stream definition file */
    :
    : void print_it(const int data_value);
    :
    : main()
    : {
    : const int START = 3; // The value of START cannot be changed
    : const int STOP = 9; // The value of STOP cannot be changed
    : volatile int CENTER = 6; /* The value of CENTER may be changed
    : by something external to this
    : program. */
    : int index; /* A normal C variable */
    :
    : for (index = START ; index < STOP ; index++)
    : print_it(index);
    : } /* End of program */
    :
    :
    : void print_it(const int data_value)
    : {
    : cout << "The value of the index is " << data_value << "
    ";
    : }
    :
    :
    :
    :
    : // Result of execution
    : //
    : // The value of the index is 3
    : // The value of the index is 4
    : // The value of the index is 5
    : // The value of the index is 6
    : // The value of the index is 7
    : // The value of the index is 8
    :
    :
    : [/code]
    : [hr]
    :
    : I double click this and open this .cpp per the instructions, but with the window that it opens in I cannot find a way to compile it and see the results as the instructions state. I am curious if anyone familiar with the software can direct me to how to make it compile so I can begin learning C++? :)
    :
    [blue]
    Please correct me if Im wrong (I dont use .NET)...

    There should be a "Build" menu item in the main IDE window. Select Build->Compile, or Build->Compile and run.

    If you recieve any error messages, please post them.
    [/blue]

  • I think that you need to create a project and a unit. The unit contains your code. The project only needs to contain that unit.

    Hope that was it,
    bilderbikkel

  • : I think that you need to create a project and a unit. The unit contains your code. The project only needs to contain that unit.
    :
    : Hope that was it,
    : bilderbikkel
    :
    :

    I seem to see a lot of people saying that Borland C++ is better, I am curious at what others use so I can decide for myself. MS Visual Studio .NET 2003 was just what my college had and provided to me.

    I have a copy of Borland C++ Builder 6 too, should I stick with that?

  • : : I think that you need to create a project and a unit. The unit contains your code. The project only needs to contain that unit.
    : :
    : : Hope that was it,
    : : bilderbikkel
    : :
    : :
    :
    : I seem to see a lot of people saying that Borland C++ is better, I am curious at what others use so I can decide for myself. MS Visual Studio .NET 2003 was just what my college had and provided to me.
    :
    : I have a copy of Borland C++ Builder 6 too, should I stick with that?
    :
    :
    [blue]
    Use whatever you are most familiar with. I personally use Borland Builder 5 and Microsoft Visual Studio 2005 (My favoriate) for win32 development. Nontheless, other compilers (such as DevC++) are very capable as well.

    Use whatever you feel most comfortable in.
    [/blue]
  • : : : I think that you need to create a project and a unit. The unit contains your code. The project only needs to contain that unit.
    : : :
    : : : Hope that was it,
    : : : bilderbikkel
    : : :
    : : :
    : :
    : : I seem to see a lot of people saying that Borland C++ is better, I am curious at what others use so I can decide for myself. MS Visual Studio .NET 2003 was just what my college had and provided to me.
    : :
    : : I have a copy of Borland C++ Builder 6 too, should I stick with that?
    : :
    : :
    : [blue]
    : Use whatever you are most familiar with. I personally use Borland Builder 5 and Microsoft Visual Studio 2005 (My favoriate) for win32 development. Nontheless, other compilers (such as DevC++) are very capable as well.
    :
    : Use whatever you feel most comfortable in.
    : [/blue]
    :

    I think i'll play with visual studio a bit more, I like the look of it anyway. If I can figure out how to compile the programs properly i'm sure i'll be in business. Going to try to assign it a project and solution as it was said earlier in this thread and see if that makes a difference.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories