variable feedback

  • cyberdragon442
    24th Sep 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • grandmaster
    24th Sep 2012 Member 0 Permalink

    Can you send me the source so I can look it up for you, put it on pastebin or something like that

  • lolzy
    24th Sep 2012 Former Staff 0 Permalink

    If we have a programming help thread going, I'm currently learning  C# with my school. And my friend challenged me to make a card shuffler. I've got my array set up with all the values the cards can take up and I'm just trying to set it up so that two cards are swapped and it iterates through that 100 times, then processes the output. But silly ol' me messed up a little bit and it repeats the same cards over and over 100 times :3

    Help pl0x?

  • cyberdragon442
    25th Sep 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • grandmaster
    25th Sep 2012 Member 0 Permalink

    I see why it creates an infinite loop cause this here "if(compTotal <15){

    • hit++;
    •              goto next1;"

    should be made so it only allows it to run 1 time but instead the comTotal variable stays smaller then 15 so the hit keeps increasing, next is never executed cause hit keeps increasing, maybe add

     

    while(compTotal <15){

    • (hit++ && compTotal++);
    •              goto next1;

    dunno something like that should work or else figure out yourself ( I'm still learning c++ so excuse me  if I make mistakes)

     

    Edit: if this is not fixed by the weekend I will compile it and then try to fix it

     

     

    EDIT EDIT:

    for lolzy, try to swap them all at the same time it works much more efficient, there is no need to swap them 2 by 2, just use the vector and an iterator for it

  • cyberdragon442
    25th Sep 2012 Banned 0 Permalink
    This post is hidden because the user is banned
  • mniip
    26th Sep 2012 Developer 0 Permalink
    @.@ GOTO PROGRAMMING? Raptors ate watching you...
    xkcd reference
  • boxmein
    26th Sep 2012 Former Staff 0 Permalink
    @cyberdragon442 (View Post)
    @grandmaster (View Post)
    Seriously though, never use goto in programming. It's called an unconditional jump and it results in bad code.
  • grandmaster
    26th Sep 2012 Member 0 Permalink

    @cyberdragon442 (View Post)

    Can you put your code into void functions please it's much better to understand then (just a tip) also I can't see what it wrong now with it and I'm glad that the while loop worked

  • cyberdragon442
    26th Sep 2012 Banned 0 Permalink
    This post is hidden because the user is banned