Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 41
  1. #16
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,979
    Reputation
    343
    Thanks
    4,312
    My Mood
    Cheeky
    heres the problem:
    double Feet;
    and
    double Furlong = Ft2Frlng(Feet);

    What type is the param of Ft2Frlng? and what are you passing to it?
    Ah we-a blaze the fyah, make it bun dem!

  2. The Following User Says Thank You to Hell_Demon For This Useful Post:

    ilovecookies (11-13-2009)

  3. #17
    ilovecookies's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    In the C++ Section
    Posts
    321
    Reputation
    10
    Thanks
    67
    My Mood
    Shocked
    Quote Originally Posted by Hell_Demon View Post
    heres the problem:
    double Feet;
    and
    double Furlong = Ft2Frlng(Feet);

    What type is the param of Ft2Frlng? and what are you passing to it?
    Yup. I figured it out. =) I changed the Param of Ft2Furlong(int) to Ft2Furlong(double) and Ft2Furlong(double Feet). Now i'm struggling to compile a program that has 2 functions in it that prints
    Code:
    Three Blind Mice.
    Three Blind Mice.
    See How They run.
    See How They Run.
    I recon I use void functionname(void) but I don't now what I would return? But if I have to return Three Blind Mice, wouldn't I need a return of some sort? Would it be String? char? What?
    Quote Originally Posted by Jules Winnfield View Post
    I am the tyranny of evil men, and you are all the weak. But i'm trying Ringo,i'm trying real hard, to become the shepherd.
    excuse me miss, would you kindly reflect some photons off the epidermis covering your sternum directly into the camera iris or vacate the proximity immediately










  4. #18
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,979
    Reputation
    343
    Thanks
    4,312
    My Mood
    Cheeky
    Quote Originally Posted by ilovecookies View Post
    Yup. I figured it out. =) I changed the Param of Ft2Furlong(int) to Ft2Furlong(double) and Ft2Furlong(double Feet). Now i'm struggling to compile a program that has 2 functions in it that prints
    Code:
    Three Blind Mice.
    Three Blind Mice.
    See How They run.
    See How They Run.
    I recon I use void functionname(void) but I don't now what I would return? But if I have to return Three Blind Mice, wouldn't I need a return of some sort? Would it be String? char? What?
    A void does not return anything.
    either use return; at the end of your void or nothing at all(both are fine).
    Ah we-a blaze the fyah, make it bun dem!

  5. The Following User Says Thank You to Hell_Demon For This Useful Post:

    ilovecookies (11-13-2009)

  6. #19
    ilovecookies's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    In the C++ Section
    Posts
    321
    Reputation
    10
    Thanks
    67
    My Mood
    Shocked
    This is where i'm at right now HD

    Code:
    #include <iostream>
    
    char ThrBlMi();
    char CHwThyRn();
    
    int main()
    {
        using namespace std;
        cout << ThrBlMi() << endl;
        cout << ThrBlMi() << endl;
        cout << CHwThyRn() << endl;
        cout << CHwThyRn() << endl;
        system("pause");
        return 0;
    }
    
    char ThrBlMi()
    {
          return "Three Blind Mice.";
    }
    
    char CHwThyRn()
    {
           return "See How They Run.";
    }

    I get errors and I know why, but I don't know how to fix it. It's because i'm using char as the function header. But I don't know what I could use. I tried string and it said string was invalid. What does my header need to be to get the return i'm looking for?
    Quote Originally Posted by Jules Winnfield View Post
    I am the tyranny of evil men, and you are all the weak. But i'm trying Ringo,i'm trying real hard, to become the shepherd.
    excuse me miss, would you kindly reflect some photons off the epidermis covering your sternum directly into the camera iris or vacate the proximity immediately










  7. #20
    Disturbed's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Posts
    10,468
    Reputation
    1267
    Thanks
    2,581
    Quote Originally Posted by ilovecookies View Post
    This is where i'm at right now HD

    Code:
    #include <iostream>
    
    char ThrBlMi();
    char CHwThyRn();
    
    int main()
    {
        using namespace std;
        cout << ThrBlMi() << endl;
        cout << ThrBlMi() << endl;
        cout << CHwThyRn() << endl;
        cout << CHwThyRn() << endl;
        system("pause");
        return 0;
    }
    
    char ThrBlMi()
    {
          return "Three Blind Mice.";
    }
    
    char CHwThyRn()
    {
           return "See How They Run.";
    }

    I get errors and I know why, but I don't know how to fix it. It's because i'm using char as the function header. But I don't know what I could use. I tried string and it said string was invalid. What does my header need to be to get the return i'm looking for?
    Usualy int, but I just tried to compile it and it said I couldn't convert const char to int :/.

    It should be compiling without a problem (At least thats what it seems like to me).

    EDIT:
    It might be bacuase your calling them in 'cout'. The complier is looking for text to output.

    Just and idea, not sure.
    Last edited by Disturbed; 11-13-2009 at 05:20 PM.


  8. The Following User Says Thank You to Disturbed For This Useful Post:

    ilovecookies (11-13-2009)

  9. #21
    ilovecookies's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    In the C++ Section
    Posts
    321
    Reputation
    10
    Thanks
    67
    My Mood
    Shocked
    Really dumb question, but how else could I call them? Just on their own? Like instead of cout just state them?

    EDIT!

    ObamaBinLaden, i'm getting the same const char conversion error. And i've tried changed my function headers to everything I can think of. No clue what's wrong.
    Last edited by ilovecookies; 11-13-2009 at 05:44 PM.
    Quote Originally Posted by Jules Winnfield View Post
    I am the tyranny of evil men, and you are all the weak. But i'm trying Ringo,i'm trying real hard, to become the shepherd.
    excuse me miss, would you kindly reflect some photons off the epidermis covering your sternum directly into the camera iris or vacate the proximity immediately










  10. #22
    zeco's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    Canada
    Posts
    683
    Reputation
    12
    Thanks
    78
    My Mood
    Cynical
    Ok the problem as i see it is that the function return type should be char*. A pointer to character, because what you are returning is a string, which in C++ can be represented as a pointer to char. I may be incorrect but that's the first thing that jumped out at me.
    Last edited by zeco; 11-13-2009 at 08:41 PM.

  11. The Following User Says Thank You to zeco For This Useful Post:

    ilovecookies (11-13-2009)

  12. #23
    A⁴'s Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    I want my minion back /fosho.
    Posts
    4,001
    Reputation
    67
    Thanks
    437
    My Mood
    Flirty
    Quote Originally Posted by ilovecookies View Post
    Hey, thanks alot for the great explanation! No less than what i've seen you describe to other people. But now I have one last question regarding functions.

    Everytime the function is called, do you have to make a prototype? Or do you only have to make the prototype at the initial use of the function?
    If so, why don't you thank him?

  13. The Following User Says Thank You to A⁴ For This Useful Post:

    ilovecookies (11-13-2009)

  14. #24
    ilovecookies's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    In the C++ Section
    Posts
    321
    Reputation
    10
    Thanks
    67
    My Mood
    Shocked
    Quote Originally Posted by zeco View Post
    Ok the problem as i see it is that the function return type should be char*. A pointer to character, because what you are returning is a string, which in C++ can be represented as a pointer to char. I may be incorrect but that's the first thing that jumped out at me.
    Alright! That brings up a whole new issue. I haven't quite reached pointers yet. Should I just abandon said project until I know more about pointers?

    Quote Originally Posted by AirBourne View Post
    If so, why don't you thank him?

    I just went through and thanked everyone who replied to my thread. No information is bad information.
    Last edited by ilovecookies; 11-13-2009 at 08:45 PM.
    Quote Originally Posted by Jules Winnfield View Post
    I am the tyranny of evil men, and you are all the weak. But i'm trying Ringo,i'm trying real hard, to become the shepherd.
    excuse me miss, would you kindly reflect some photons off the epidermis covering your sternum directly into the camera iris or vacate the proximity immediately










  15. #25
    lalakijilp's Avatar
    Join Date
    Jan 2008
    Gender
    male
    Posts
    310
    Reputation
    9
    Thanks
    53
    My Mood
    Blah
    original:

    Code:
    #include <iostream>
    
    char ThrBlMi();
    char CHwThyRn();
    
    int main()
    {
        using namespace std;
        cout << ThrBlMi() << endl;
        cout << ThrBlMi() << endl;
        cout << CHwThyRn() << endl;
        cout << CHwThyRn() << endl;
        system("pause");
        return 0;
    }
    
    char ThrBlMi()
    {
          return "Three Blind Mice.";
    }
    
    char CHwThyRn()
    {
           return "See How They Run.";
    }
    lala's version:

    Code:
    #include <iostream>
    
    using namespace std;
    
    void ThrBlMi();
    void CHwThyRn();
    
    int main()
    {
        
        ThrBlMi();
        ThrBlMi();
        CHwThyRn();
        CHwThyRn();
        system("pause");
        return 0;
    }
    
    void ThrBlMi()
    {
          cout << "Three Blind Mice." <<endl;
    }
    
    void CHwThyRn()
    {
           cout << "See How They Run." << endl;
    }
    try to make the code as easy as possible. (in main at least)
    when you don't need to use variables in your functions don't call them.

    here is another example with .... i forgot the name...

    dunno if it works because i am not at my "C++ PC"

    edit: tested and works

    when there is no variable put in when calling the function foramountoftimesdisplayed is 1.

    lala's 1337 version:
    Code:
    #include <iostream>
    
    using namespace std;
    
    void ThrBlMi(int amountoftimesdisplayed = 1);
    void CHwThyRn(int amountoftimesdisplayed = 1);
    
    int main()
    {
        ThrBlMi(2);
        CHwThyRn(2);
        system("pause");
        return 0;
    }
    
    void ThrBlMi(int amountoftimesdisplayed)
    {
          for(int i=1; amountoftimesdisplayed >= i; i++)
          cout << "Three Blind Mice." <<endl;
    }
    
    void CHwThyRn(int amountoftimesdisplayed)
    {
           for(int i=1;amountoftimesdisplayed >= i; i++)
           cout << "See How They Run." << endl;
    }
    Last edited by lalakijilp; 11-14-2009 at 05:41 AM.

  16. The Following User Says Thank You to lalakijilp For This Useful Post:

    ilovecookies (11-14-2009)

  17. #26
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,979
    Reputation
    343
    Thanks
    4,312
    My Mood
    Cheeky
    Quote Originally Posted by ilovecookies View Post
    This is where i'm at right now HD

    Code:
    #include <iostream>
    
    char ThrBlMi();
    char CHwThyRn();
    
    int main()
    {
        using namespace std;
        cout << ThrBlMi() << endl;
        cout << ThrBlMi() << endl;
        cout << CHwThyRn() << endl;
        cout << CHwThyRn() << endl;
        system("pause");
        return 0;
    }
    
    char ThrBlMi()
    {
          return "Three Blind Mice.";
    }
    
    char CHwThyRn()
    {
           return "See How They Run.";
    }

    I get errors and I know why, but I don't know how to fix it. It's because i'm using char as the function header. But I don't know what I could use. I tried string and it said string was invalid. What does my header need to be to get the return i'm looking for?
    try this:
    Code:
    prototype:
    char *CHwThyRn();
    
    function:
    char *CHwThyRn()
    {
        char *retbuf="See How They Run.";
        return retbuf;
    }
    Apply the same to the other function
    Try figuring out why this works by yourself. if you're unable to figure it out just ask
    Ah we-a blaze the fyah, make it bun dem!

  18. The Following User Says Thank You to Hell_Demon For This Useful Post:

    ilovecookies (11-14-2009)

  19. #27
    Disturbed's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Posts
    10,468
    Reputation
    1267
    Thanks
    2,581
    Quote Originally Posted by Hell_Demon View Post
    try this:
    Code:
    prototype:
    char *CHwThyRn();
    
    function:
    char *CHwThyRn()
    {
        char *retbuf="See How They Run.";
        return retbuf;
    }
    Apply the same to the other function
    Try figuring out why this works by yourself. if you're unable to figure it out just ask
    This would also allow you to call them the way you previously were.


  20. The Following User Says Thank You to Disturbed For This Useful Post:

    ilovecookies (11-14-2009)

  21. #28
    ilovecookies's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    In the C++ Section
    Posts
    321
    Reputation
    10
    Thanks
    67
    My Mood
    Shocked
    Quote Originally Posted by Hell_Demon View Post
    try this:
    Code:
    prototype:
    char *CHwThyRn();
    
    function:
    char *CHwThyRn()
    {
        char *retbuf="See How They Run.";
        return retbuf;
    }
    Apply the same to the other function
    Try figuring out why this works by yourself. if you're unable to figure it out just ask


    I integrated this into my program, but now it just displays "Press any key to continue..." It doesn't display the contents of the functions. This is the code

    Code:
    #include <iostream>
    
    char *ThrBlMi();
    char *CHwThyRn();
    
    int main()
    {
        using namespace std;
       char *ThrBlMi();
       char *ThrBlMi();
       char *CHwThyRn();
       char *CHwThyRn();
        system("pause");
        return 0;
    }
    
    char *ThrBlMi()
    {
          char *retbuf="Three Blind Mice";
          return retbuf;
    }
    
    char *CHwThyRn()
    {
           char *retbuf="See How They Run.";
           return retbuf;
    }
    Quote Originally Posted by Jules Winnfield View Post
    I am the tyranny of evil men, and you are all the weak. But i'm trying Ringo,i'm trying real hard, to become the shepherd.
    excuse me miss, would you kindly reflect some photons off the epidermis covering your sternum directly into the camera iris or vacate the proximity immediately










  22. #29
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,979
    Reputation
    343
    Thanks
    4,312
    My Mood
    Cheeky
    Quote Originally Posted by ilovecookies View Post
    I integrated this into my program, but now it just displays "Press any key to continue..." It doesn't display the contents of the functions. This is the code

    Code:
    #include <iostream>
    
    char *ThrBlMi();
    char *CHwThyRn();
    
    int main()
    {
        using namespace std;
       char *ThrBlMi();
       char *ThrBlMi();
       char *CHwThyRn();
       char *CHwThyRn();
        system("pause");
        return 0;
    }
    
    char *ThrBlMi()
    {
          char *retbuf="Three Blind Mice";
          return retbuf;
    }
    
    char *CHwThyRn()
    {
           char *retbuf="See How They Run.";
           return retbuf;
    }
    Code:
    #include <iostream>
    
    char *ThrBlMi();
    char *CHwThyRn();
    
    int main()
    {
        using namespace std;
        cout<<ThrBlMi()<<endl;
        cout<<ThrBlMi()<<endl;
        cout<<CHwThyRn()<<endl;
        cout<<CHwThyRn()<<endl;
        system("pause");
        return 0;
    }
    
    char *ThrBlMi()
    {
          char *retbuf="Three Blind Mice";
          return retbuf;
    }
    
    char *CHwThyRn()
    {
           char *retbuf="See How They Run.";
           return retbuf;
    }
    Ah we-a blaze the fyah, make it bun dem!

  23. The Following User Says Thank You to Hell_Demon For This Useful Post:

    ilovecookies (11-14-2009)

  24. #30
    ilovecookies's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    In the C++ Section
    Posts
    321
    Reputation
    10
    Thanks
    67
    My Mood
    Shocked
    Quote Originally Posted by Hell_Demon View Post
    Code:
    #include <iostream>
    
    char *ThrBlMi();
    char *CHwThyRn();
    
    int main()
    {
        using namespace std;
        cout<<ThrBlMi()<<endl;
        cout<<ThrBlMi()<<endl;
        cout<<CHwThyRn()<<endl;
        cout<<CHwThyRn()<<endl;
        system("pause");
        return 0;
    }
    
    
    
    char *ThrBlMi()
    {
          char *retbuf="Three Blind Mice";
          return retbuf;
    }
    
    char *CHwThyRn()
    {
           char *retbuf="See How They Run.";
           return retbuf;
    }


    Ooooh oh oh oh, I should've went with my original coding which included the cout object so it can display the content of the character pointer. But what differs a character pointer from a variable? Or are these questions i'll have answered by the book soon enough?
    Quote Originally Posted by Jules Winnfield View Post
    I am the tyranny of evil men, and you are all the weak. But i'm trying Ringo,i'm trying real hard, to become the shepherd.
    excuse me miss, would you kindly reflect some photons off the epidermis covering your sternum directly into the camera iris or vacate the proximity immediately










Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Where could I learn C++? (Beginner, and Advanced stuff)
    By TsumikiriX in forum C++/C Programming
    Replies: 8
    Last Post: 07-19-2006, 08:11 PM
  2. Learn Hacking
    By Loler in forum Hack Requests
    Replies: 2
    Last Post: 01-22-2006, 03:20 PM
  3. WPE problem...
    By styx23 in forum General Game Hacking
    Replies: 8
    Last Post: 01-18-2006, 07:51 PM
  4. Looking to learn.
    By SadisticGrin in forum Hack Requests
    Replies: 1
    Last Post: 01-15-2006, 06:57 PM
  5. Problem Wit Hacking Programs
    By f5awp in forum General Gaming
    Replies: 5
    Last Post: 01-10-2006, 05:44 AM

Tags for this Thread