uhh prob w/ code

This is a discussion on uhh prob w/ code within the C Programming forums, part of the General Programming Boards category; Darnit!!! For some reason it goes ahead and skips the amount of times its supposed to loop. Heres the code. ...

  1. #1
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269

    uhh prob w/ code

    Darnit!!!
    For some reason it goes ahead and skips the amount of times its supposed to loop. Heres the code. Try your best to reply as fast as you can!!



    Code

    #include <iostream.h>
    #include <conio.h>
    #include <stdlib.h>

    int main()
    {
    int time = 0;
    char name[500];
    int times;
    clrscr();
    cout<<"First type a sentence>";
    cin>>name[500];
    cout<<"Now type the number of times you want your sentence to appear>";
    cin>>times; //It just aint readin dis
    cout<<"Good, now press a key and sit back.......";
    getch();
    clrscr();
    while (time != times)
    {
    time = time + 1;
    int x = rand() % 80;
    int y = rand() % 24;
    gotoxy(x, y);
    cout<<name;
    }
    getch();
    return 0;
    }


    please help me
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    Umm, this is just a guess, but I think you might need to replace this line...
    cin>>name[500];

    with this...

    cin>>name;

    If that doesn't work, try the C++ board.
    Callou collei we'll code the way
    Of prime numbers and pings!

  3. #3
    Registered User zahid's Avatar
    Join Date
    Aug 2001
    Posts
    532
    Here is no error with loop. Loop is working perfectly.

    It's because of
    {
    gotoxy() ... and
    int x = rand() % 80; /**/
    int y = rand() % 24; /**/
    }

    and this receives a word from keyboard.
    cin>>name[100] ;

    What did you want to with gotoxy().. ?
    [ Never code before desk work ]
    -------------------------------------:-->
    A man who fears Nothing is the man who Loves Nothing
    If you Love Nothing, what joy is there in your life.
    =------------------------------------------------------= - I may be wrong.

  4. #4
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    lol, i fixed it, here is the link if you wanna see:

    http://www.angelfire.com/ab7/echat/NEATO.EXE

    if dat dont work, try

    http://www.angelfire.com/ab7/echat/hey.htm


    on the second page has the link to download, the first one is the download, i dont know if the link for the download is good but you can see for yourself
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  5. #5
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    well, first and second link dont work. heres the real link:

    http://www.angelfire.com/ab7/echat/hey
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  6. #6
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    darnit, that link dont work, you have to copy paste the link into your address bar if you wanna goto it
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proposal: Code colouring
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  3. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 11:38 AM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 4
    Last Post: 01-15-2002, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21