Thursday, July 30, 2009

Convert current c++ project to visual studios express?

i just learned some c++. i dont remember my original program, but when i try to import a perfect (in the other c++ program) to visual studios express, a different c++ program, i got many errors. i tried to understand them, but couldnt, though i think that different c+++ programs are slightly differnt in language.





can someone plz tell me the differences between my old program and express? and how to modify my old code so it works in express?





i dont know the name of the program but this is the code:





#include %26lt;iostream%26gt;


int main()





char grid [3][3];





void gridprint()


{


for (int y = 0; y %26lt; 3; y ++)


{


for (int z = 0; z %26lt; 3; z++)


{


cout %26lt;%26lt;grid [y][z];


}


cout %26lt;%26lt; endl;


}


}


int main()


{





cout %26lt;%26lt; "TICTACTOE \n \n " %26lt;%26lt; endl;





char x = 'X';


char o = 'O';


int y;


int z;


bool win = false;


int turns = 0;


char player = o;





// making empty spaces -'s


for (y = 0; y %26lt;3; y++)


{


for(z=0; z %26lt; 3; z++)


{


thx in advanc

Convert current c++ project to visual studios express?
Can you state the exact error that visual express is complaining about? That would kind of help.





I do see one problem in the code. cout and cin are in the namespace "std", theofore you can't just use them like global variables without declaring using the the "std" namespace. This is commonly done by adding "using namespace std;" before any use of cout or cin like so.





#include %26lt;iostream%26gt;





using namespace std; //declaring use of namespace





int main()


{


int example;


cin%26gt;%26gt;example; //now you can use cin and cout like


cout%26lt;%26lt;example%26lt;%26lt;endl; //this





return 0;


}
Reply:For getting project assignment help there are better websites like http://getafreelnacer.com/
Reply:Your gridprint function is not declaring the local variables x, y, z it is using. Your program wouldn't compile under any compiler. It's not a Visual Studio problem.
Reply:First, never ever post large blocks of unformatted code. When there is no way of posting formatted code, use a pastebin like http://www.rafb.net/paste/ (or just google for other pastebins / nopaste sites).





Second, C++ is a language. Not a program. It’s a standard language too, so there isn’t really a Visual C++ vs g++ C++ vs Comeau. Assume your code is broken. Now try to fix it. If you don’t know how, as I said, post the code on a nopaste site, so we can see it properly formatted. Then try compiling it, with all warnings on (compiler flag /W4 ), and post these warnings/errors on a nopaste site as well.

wedding flowers

No comments:

Post a Comment