Complete noob to C++, got a few simple questions

So I started a college class completely focused on C++, it's only a month and I have like 10 homeworks, they get more and more hard.

I have Visual Studio 2008, I never programmed in my life.

So, I have like 4 homeworks like this, where a set of instructions are displayed and at the end it asks me the final value of x,y,z.

int x=10, y= 5,z=0;



if(( y > x) || (z==0))

if(x%y==0)

z++;

else

{

y=x++;

x=y--;

}

provide value for x,y and z:

My question is, how can I execute or check on Visual Studio the value for that? I think you have to compile or something but I have no idea how to run that to see the final result.

I have another example, in this one it asks me to tell what will this display on the screen:



#include <iostream>
using namespace std;

void funcion(int a, int b, int &c)
{
int j;

j = c + 4;
b= j * c;
c = (c * 4) - j;
}

int main()
{
int x = 2, y = 4, z = 6;

funcion(y, x, z);
cout<<x<<" "<<y<<" "<<z<<endl;
return 0;
}

Any help?
Last edited on
cout << ... is used to display things http://cplusplus.com/doc/tutorial/basic_io/
alright lets suppose I can get the code right for input/output (which I can't), what's the procedure to actually make it display?

I used Java a little before, in there you would code, compile it, and then open it on a browser as far as I remember, how is it done in C++?
Just compile it and then run the resulting .exe you get.

You can't normally run C++ in a browser because C++ is compiled for the machine you compile it on. Java is compiled for the Java Virtual Machine which basically does the actually compiling at the last second when you run the program.
alright and can I know how to compile on Visual Studio 08? I read a document on how to but it was for an old version of C++ where you had to select the "Build" dropdown but theres no such thing on this one.
Search around at the top mousing over icons. I haven't used VC but it'll either be called compile or build. There will also be a compile and run or build and run option that will do exactly what it says. There will also be a run button at the top so you don't have to look the .exe.
There is a build menu in VC++ 08 >_>

Fifth from the left.
Topic archived. No new replies allowed.