Seite 31 von 340 ErsteErste ... 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 81 131 ... LetzteLetzte
Zeige Ergebnis 901 bis 930 von 10174

C/C++ Programming Help Thread

This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; i m developing for pc now Code: #include <cstdlib> #include <iostream> #include <conio.h> using namespace std; int mult (int x, ...

  
  1. #901
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    i m developing for pc now
    Code:
    #include <cstdlib>
    #include <iostream>
    #include <conio.h>
    
    
    using namespace std;
    
    int mult (int x, int y);  //samenbrengen
    
    inline void vermenigvuldigen()
    {
       int x;
    int y;
    
    
    cout<<"schrijf een getal voor te vermenigvuldigen/optellen/aftrekken of delen: ";
    cin>>x;
    
    cout<<"schrijf een tweede getal om het eerste mee te bewerken ";
    
    cin>>y;
    cin.ignore();
    cout<<"het produkt van de 2 getallen is "<<mult (x,y)<<"\n";
    cout<<"de som van de 2 getallen is "<<x+y<<"\n";
    cout<<"het quotient van de 2 getallen is "<<x/y<<"\n";
    cout<<"en met aftrekken bekomen we "<<x-y<<"\n";
    printf("gemaakt door ROEL\n\n\n\n\n\n\n\n\n");
    vermenigvuldigen();
    cin.get();
    }
    int mult (int x, int y)
    {
        return x*y;
    }    
    
    int main()
    {
    vermenigvuldigen();
    cin.get();
    }
    the problem is
    if you type 999999999999 , the program crashed
    what can you do so you cant type it
    ps : i tried this already
    if (x>99999999){
    printf("pleas enter another nuber, it's to big")
    vermenigvuldigen();
    }



  2. #902
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    The int datatype can't handle that much data, change it to a long or something.


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  3. #903
    Developer
    Points: 5.359, Level: 47
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Norway
    Beiträge
    384
    Points
    5.359
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von homer
    The int datatype can't handle that much data, change it to a long or something.
    I thought both a long and int had the same size (4 bytes) on the psp? or have I been misinformed?

    I use double for those huge variables.


  4. #904
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    cant you block for using to much data???
    so i can just use int???
    -= Double Post =-
    Zitat Zitat von waterbottle
    I thought both a long and int had the same size (4 bytes) on the psp? or have I been misinformed?

    I use double for those huge variables.
    this is for PC
    (everbody told me to learn it first on pc and than on psp)
    Geändert von hallo007 (09-17-2006 um 08:03 AM Uhr) Grund: Automerged Doublepost

  5. #905
    Developer
    Points: 5.359, Level: 47
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Norway
    Beiträge
    384
    Points
    5.359
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von hallo007
    cant you block for using to much data???
    so i can just use int???
    -= Double Post =-

    this is for PC
    (everbody told me to learn it first on pc and than on psp)
    ah, ok then.

    I'm not sure, but maybe you could do:
    if((cin>>y)>sizeof(int)) {
    //code if to big
    } else {
    }

    that might not work though..


  6. #906
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    No it won't... He wouldn't be able to use the data.

    You might want to change it to an unsigned int though.
    Or if you want a long long (it can handle values from –9,223,372,036,854,775,80 7 to 9,223,372,036,854,775,807 )


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  7. #907
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    mayby i can just write an warning
    that's easier for me:d

  8. #908
    Developer
    Points: 14.378, Level: 77
    Level completed: 82%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Ort
    Boston, MA
    Beiträge
    1.389
    Points
    14.378
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Could someone tell me if PC SDL and PSP SDL are the same?
    thanks.
    --Vaza

  9. #909
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Not exactly no.

    PSP SDL is slow as some of the rendering is done in software.

    Check out my homebrew & C tutorials at http://insomniac.0x89.org/
    Coder formerly known as Insomniac197

    tshirtz: what is irshell ??
    Atarian_: it's where people who work for the IRS go when they die

  10. #910
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    I think he means the functions though... As far as I know the functions should be he same

  11. #911
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard @$$h4wl3$!

    can someone explain to me the basic func's in C?

  12. #912
    QJ Gamer Blue
    Points: 5.768, Level: 49
    Level completed: 9%, Points required for next Level: 182
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    457
    Points
    5.768
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    printf("hello world")
    prints hello world on the psp screen.

  13. #913
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von PSP-Maniac
    printf("hello world")
    prints hello world on the psp screen.
    um, no it doesnt...
    it does if you define it like this
    Code:
    #define printf pspDebugScreenPrintf
    and still you didn't clarify the x and y coordinates..

    And if you want a full documentation check out this http://psp.jim.sh/pspsdk-doc/

  14. #914
    QJ Gamer Blue
    Points: 5.768, Level: 49
    Level completed: 9%, Points required for next Level: 182
    Overall activity: 0%

    Registriert seit
    May 2006
    Beiträge
    457
    Points
    5.768
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Bronx
    um, no it doesnt...
    it does if you define it like this
    Code:
    #define printf pspDebugScreenPrintf
    and still you didn't clarify the x and y coordinates..

    And if you want a full documentation check out this http://psp.jim.sh/pspsdk-doc/
    hehe sorry forgot that.

  15. #915
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard coding

    how can you change the text color in C?

  16. #916
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von psphacker12.
    how can you change the text color in C?
    Depends on what you use to print the text...


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  17. #917
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    i use
    Code:
    pspDebugScreenPrintf("wassup homedawg, hows it hangin?")

  18. #918
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    Okay, then you'll have to use the
    pspDebugScreenSetTextColo r
    function.

    Example:
    Code:
    #define RGB(r,g,b) (((b)<<16)|((g)<<8)|(r))
    
    int main(int argc, char **argv)
    {
      pspDebugScreenInit();
      pspDebugScreenSetTextColor(RGB(255, 0, 0)); // change color to red
      pspDebugScreenPrintf("Red");
      pspDebugScreenSetTextColor(RGB(0, 255, 0)); // change color to green
      pspDebugScreenPrintf("Green");
      pspDebugScreenSetTextColor(RGB(0, 0, 255)); // change color to blue
      pspDebugScreenPrintf("Blue");
    }


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  19. #919
    Developer
    Points: 5.359, Level: 47
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Norway
    Beiträge
    384
    Points
    5.359
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    If I wanted to change/read a memory address could I do somthing like this
    int *pointer = 0x88000000;
    ?

    and how could I do it if the memory address is a pointer to a different address and I wanted the pointer to point to that?

    like,
    int *pointer = 0x88000000;


    0x88000000 is 0x88100004
    so the pointer now points to 0x88100004. How should I do that?


  20. #920
    QJ Gamer Silver
    Points: 14.087, Level: 77
    Level completed: 10%, Points required for next Level: 363
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Germany
    Beiträge
    926
    Points
    14.087
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    better typecast the address to a pointer (though it should compile with a mere warning without it):
    int* pointer = (int*)0x88000000;

    To change the pointer, just do
    pointer = (int*)0x88100004;
    Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
    Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
    Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
    Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.

  21. #921
    Art
    Art ist offline
    Bush Programmer
    Points: 60.149, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Nov 2005
    Beiträge
    3.658
    Points
    60.149
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Hi Guys,
    After a little help with file IO .. writing/reading a file from two different buffers.
    Yes I could copy them to a single buffer, and do it the normal way if there
    were enough RAM, but there isn't.

    Code:
    	int f;
    
    	f = sceIoOpen("./folder/file.txt", PSP_O_RDONLY, 0777);
    	sceIoRead(f,buffer_a,10000);
    	sceIoRead(f,buffer_b,20000);
    	sceIoClose(f);
    I thought the above would work, but it doesn't seem to.. any ideas?
    -= Double Post =-
    forget it, that IS the right way,
    I dunno what I was doing wrong before.
    Geändert von Art (09-18-2006 um 09:44 PM Uhr) Grund: Automerged Doublepost

  22. #922
    QJ Gamer Green
    Points: 8.011, Level: 60
    Level completed: 31%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    ~Behind You~
    Beiträge
    884
    Points
    8.011
    Level
    60
    Downloads
    0
    Uploads
    0

    Standard

    ok can anyone show me how an hello world is made?

  23. #923
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  24. #924
    QJ Gamer Green
    Points: 8.011, Level: 60
    Level completed: 31%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    ~Behind You~
    Beiträge
    884
    Points
    8.011
    Level
    60
    Downloads
    0
    Uploads
    0

    Standard

    wow thats hard to understand!
    -= Double Post =-
    i mean an hello world for the tiff sdk
    Geändert von Jetlitheone (09-19-2006 um 04:01 PM Uhr) Grund: Automerged Doublepost

  25. #925
    Developer
    Points: 5.359, Level: 47
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Norway
    Beiträge
    384
    Points
    5.359
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Jetlitheone
    wow thats hard to understand!
    -= Double Post =-
    i mean an hello world for the tiff sdk
    If you think hello world for the normal sdk is hard then I wouldn't advice you to try it with the tiffsdk


  26. #926
    QJ Gamer Green
    Points: 8.011, Level: 60
    Level completed: 31%, Points required for next Level: 139
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    ~Behind You~
    Beiträge
    884
    Points
    8.011
    Level
    60
    Downloads
    0
    Uploads
    0

    Standard

    its harder?

    WOAH

  27. #927
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    try learning the c language first by going here cprogramming.com

  28. #928
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    1. hi guys. i need a couple of functions in C. i can seem to find anything.. (literally)

    here is what i need: (i think they should all be in one of the libs)

    a function that does the sin of something.
    a function that does the cosin of something.
    a function that does the tangent (tan) of something.

    a function that converts degrees to radians


    2. ALSO, how would i "blit" a 3D model to the screen using x,y,z positionst? (in 3D)

    YES, i have read BILLIONS of tutorials, looked at the samples, BUT, all of them use prespective. i want to actually "blit" a model using x,y, and z coordinates, and be able to change them.
    --------------------------------------------------------------------------------------

  29. #929
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Grimfate126
    1. hi guys. i need a couple of functions in C. i can seem to find anything.. (literally)

    here is what i need: (i think they should all be in one of the libs)

    a function that does the sin of something.
    a function that does the cosin of something.
    a function that does the tangent (tan) of something.

    a function that converts degrees to radians


    2. ALSO, how would i "blit" a 3D model to the screen using x,y,z positionst? (in 3D)

    YES, i have read BILLIONS of tutorials, looked at the samples, BUT, all of them use prespective. i want to actually "blit" a model using x,y, and z coordinates, and be able to change them.
    C already has built-in functions for sin, cos and tan. You just have to include math.h. The functions are named:
    Code:
    sin();
    cos();
    tan();


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

  30. #930
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von homer
    C already has built-in functions for sin, cos and tan. You just have to include math.h. The functions are named:
    Code:
    sin();
    cos();
    tan();

    wat about converting degrees to radians?
    --------------------------------------------------------------------------------------


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 09:27 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .