anyone good in C++?

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
Comments
31
c--/+c+/--c
Why not posting your problems here? :)
hackers can!
I learned C++. i might help you ?!
he doesnt need help. he wants someone to do it for him and then explain how it works.
Parent
yes clearly.
Parent
your english...........
Parent
ask pansemuckl
ask Finland///Pale
he'll include multihack in Battleships
Parent
ask panse
post your program, and I'll tell you what are the mistakes.
http://codepad.org/PVjac9YZ

the error in line 33 is supposed to be there as to codepad not try and run it!
Parent
ask Polandyuppie
is it okay if i fix ur errors and add some code which has nothing to do with anything
I learnt some C++ but without a proper question and code i cant help you :P german names is nothing..
SHow us what you already got, what you tried and stuff, errors. you can't expect us to make it for you.
http://codepad.org/PVjac9YZ

thats where i am now (error in line 33 is supposed to be there so codepad doesn't try and run the code)
Parent
while(Schlachtschiff==0)
Parent
you clearly read what i said :D
Parent
Does it really have to be written in c++? Simple games like that can easily be made in vb.NET or so
while(Schlachtschiff=0)

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?
yea it doesn't change much with the = or == 0 cause i set it to 1 once i placed that ship and as for the class thing i figured that out by now ;D it is working but i messed up the x and y coordinates for the ship placing thing!

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
Parent
it changes big fucking much whether you set it to 1 or not since :

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 :)
Parent
yeah it's working fine now... took me long enough though :D

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
Parent
well, the problem of not placing boats above each other should be pretty easy to fix :)

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 :)
Parent
we'll i only started programming this spring... just got it for 1 semester this is my ending project after which im prolly never gonna programm something this size again + my first method is that big cause it does too much (you weren't supposed to be able to place the ships by yourself but i only heard of that after having it done anyways :D)

so i just hope it's enough to get the ECTS points ;D
Parent
Sure it should be enough :)

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 :)
Parent
well i tried to use the "Ausgabe" method which was to print the game into the DOS window inside the "SchiffeSetzen" method where you place your ships but it said unknown function blabla :< so i instead used the code from the output method in that method got longer but does the same :X

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 :))
Parent
Yep I noticed, and you have done a good job for programming that short amount of time :) np!
Parent
Back to top