Thread: need help with my code

  1. #1
    Registered User Joe100's Avatar
    Join Date
    Jul 2003
    Posts
    63

    need help with my code

    hey all i need your help once again this damn code keeps giving me a error
    "!FUKILLER.cpp(7,28) expected
    Code:
    #include <windows>
    #include <iostream.h>
    #include <conio.h>
    #include <stdio.h>
    #include <stdlib.h>
    
    void TextPrint(char[80]Sentence,int sleep)
    int main()
    {
    
    	TextPrin"this is a test"sleep,80)
    {
    	for(int a=0; a<strlen(Sentence), att)
       }
       cout << Sentence[a];
       getch();
       }
    }
    so plz if you know what this error is can you plz tell me becuase this code is really starting to agrivate me
    "Be Quick Or Be Dead"

    [img]
    http://www.danasoft.com/sig/GU.jpg
    [/img]

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    there are so many things wrong with this code I don't know where to start.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942
    here is your fixed code

    Code:
    #include <windows.h>
    #include <iostream>//no more iostream.h
    #include <conio.h>
    #include <cstdio>//no more stdio.h
    #include <cstdlib>//no more stdlib.h
    #include <string>//for strlen()
    using namespace std;
    
    void TextPrint(char sentence[80], int sleep); /*Trailing semicolon*/
    int main()
    {
                    char sentence[80];
    	sentence = TextPrint("this is a test", 80);/*semicolon*/
    	for(int a=0; a<strlen(Sentence), att){
                          cout << sentence[a];
                          getch();
                    }
       system("PAUSE")/*waits for user to press enter. Inside of windows.h */
       return 0; /*always do this to end a program */
    }
    
    void TextPrint(char sentence[80], int sleep)
    {
              sleep(sleep); /*What is int sleep for?*/
              return sentence;
    }
    I think I fixed all the problems.... but I'm not sure...

  4. #4
    Registered User Joe100's Avatar
    Join Date
    Jul 2003
    Posts
    63
    why thank you zelda for not being rude like fillyourbraian and thank you for fixing my code this is greatly appreciated and if you ever need anything just ask me man but im not exactly sure what i could do for ya
    "Be Quick Or Be Dead"

    [img]
    http://www.danasoft.com/sig/GU.jpg
    [/img]

  5. #5
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    97
    lol

  7. #7
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,090
    By the way, gcn_zelda's code is good in that it helps point out a lot of errors and it gives one way of changing the "code" around into a real program, but in case you haven't noticed, it does not compile either and has several errors of its own. For example, the TextPrint is supposed to return void (nothing), but instead it tries to return sentence. Also, the for loop increments a with att instead of a++.

    If you really want help in learning how to write your code, maybe you could explain what you are trying to do (in English), in addition to giving your code. Then somebody can explain the concepts of how to implement what you want based on what you are having trouble with.

  8. #8
    Registered User Joe100's Avatar
    Join Date
    Jul 2003
    Posts
    63
    well im just trying to do a simple scrolling text program but the zelda gave me didnt work at all totally $$$$ed my compiler with errors so maybe some one can help or zelda could fix the errors becuase i try ed to do that and i narrowed it down to one error but i coulnd figure it out so i deleted the program
    "Be Quick Or Be Dead"

    [img]
    http://www.danasoft.com/sig/GU.jpg
    [/img]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM