anyone good in C++?
•
28 Aug 2009, 20:03
•
Journals
I need some halp for C++ please ...
I need to programm Battleships
the game you usually play with paper'n'pen
http://en.wikipedia.org/wiki/Battleship_(game)
I have to get this done till Monday but i haven't got the slightest clue on where my mistakes are in that stupid programm or to be exact the compiler tell's me where they are but i have no idea on how to solve it :D
so if anybody is out there who got like 10 min time and good c++ knowledge that'd brighten my day :<
Preferably german cause the int names are all in German :P
i would post it here but its unreadable for you :(
but i put it on codepad
http://codepad.org/QHK7VfjJ
there you go
I need to programm Battleships
the game you usually play with paper'n'pen
http://en.wikipedia.org/wiki/Battleship_(game)
I have to get this done till Monday but i haven't got the slightest clue on where my mistakes are in that stupid programm or to be exact the compiler tell's me where they are but i have no idea on how to solve it :D
so if anybody is out there who got like 10 min time and good c++ knowledge that'd brighten my day :<
Preferably german cause the int names are all in German :P
i would post it here but its unreadable for you :(
but i put it on codepad
http://codepad.org/QHK7VfjJ
there you go
the error in line 33 is supposed to be there as to codepad not try and run it!
thats where i am now (error in line 33 is supposed to be there so codepad doesn't try and run the code)
should be: while(Schlachtschiff==0)
while(Schlachtschiff=0)
should be: while(Schlachtschiff==0)
(or do you want never ending loops?)
Last one I don't know, never seen such error, but don't you have to make an object of the class before you can use its methods?
this is what happens if i put them on ==0 so it doesn't get any errors :
http://codepad.org/4hi7vw0Q
here with one error so it doesn't start :p
http://codepad.org/PVjac9YZ
while(variable=0) means: while(<it is possible for variable to be given the value of 0, continue>)
which mean, try this in a empty main-class and run:
int i;
while(i=0)
{
i++;
cout << "I need to learn statements in programming!" << endl;
}
and just watch your pc end up on it's knees begging you to end the process :)
Btw, I don't understand german so I can't be arsed about the two other errors. Make it again, make it right :)
thanks anyways ;)
i only got 1 problem left i can still place 1 ship ontop of another but i'll get that done today i think :) ... have to anyway cause i need to hand it in on monday x)
http://codepad.org/oWNB0poi
:D
EDIT:
Final Version :
http://codepad.org/yFOFPRGK
maybe i'll still change something but i've actually had enough of it :D
Nice work! Though, I personaly think that your class-methods are to large and should be divided more. But then again, I didn't study them very carefully and I dont understand German :)
so i just hope it's enough to get the ECTS points ;D
Though, when you have really large methods, you usually choose to split it up due to the simplicity of getting a good overview.
For example if you have a method which should fetch and format text for another method, then you usually make one SQL/file-reader method and use that within the called method. You gain a lot by doing so in overview, but also you limit the error-mistake and debugging time :)
But ofc, sometimes it's not possible to split up a method :)
as i said i simply started this spring so i guess since it's working as intended it'll be ok :) thanks for your help anyway :))