Search:

Type: Posts; User: xeon321

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    989

    In this case, add a semicolon behind while() and...

    In this case, add a semicolon behind while() and it will repeat until the condition is false.
    If it's not a loop, execute the statement once.

    same concept as

    while(getchar() != '\n');
    which...
  2. Replies
    5
    Views
    989

    Line 82, ' ; ' remove it :D

    Line 82, ' ; '

    remove it :D
  3. Thread: C Problems

    by xeon321
    Replies
    2
    Views
    846

    C Programming...

    C Programming
  4. You sure bro? line 47 while(option == 1)...

    You sure bro?

    line 47

    while(option == 1) {


    line 170

    } //bracket do while
  5. Replies
    18
    Views
    2,766

    There you go

    There you go
  6. Replies
    18
    Views
    2,766

    But Andi, that doesn't really work when you enter...

    But Andi, that doesn't really work when you enter something like 1a, 1- or 2abcd.. ( basically any numbers followed by a character or string)

    And when user input ' - ', it goes straight into...
  7. Thread: Validation

    by xeon321
    Replies
    5
    Views
    2,061

    (2) Add this into your else statement ...

    (2) Add this into your else statement



    while ((ch = getchar()) != '\n')
    {
    if(ch > 1)
    {
    printf("Error! Re-enter : ");
    scanf("%d", &stop);
  8. Replies
    8
    Views
    1,972

    scanf leaves a newline char behind. So if you...

    scanf leaves a newline char behind. So if you don't have 2 getchar(), the newline will be grabbed by getchar(), and your program automatically quits.
  9. oh lol , I see now. Thanks!

    oh lol , I see now. Thanks!
  10. Regarding flushing input level 2 in the tutorial

    Well, my question is, why do we need ( ch != EOF) ?



    while(( ch = getchar()) != '\n' ); //understand

    //don't understand the need of having != EOF
    while ((ch = getchar()) != '\n' && ch !=...
  11. Hmm, alright then. I will run through the books +...

    Hmm, alright then. I will run through the books + the tutorials again and rewrite everything. Thanks for the help , appreciate it :)
  12. Yeah, I was trying to simplify it because it's...

    Yeah, I was trying to simplify it because it's gonna be lengthy, but oh well...there you go.
    And sometimes, it displays

    "Unhandled exception at 0x530a3330 in PCD2Assignment.exe: 0xC0000005:...
  13. String var corrupted after strcpy from another string

    So, I'm suppose to copy the ID that user input into another variable. But somehow, it gives me some problem/error.

    For first attempt, no error shown. But, the spacing was off.
    It would be like
    ...
  14. Replies
    9
    Views
    1,949

    tidy up your codes please D:

    tidy up your codes please D:
  15. Replies
    3
    Views
    1,610

    Hmm...Sad...Thanks for the help anyway. I guess I...

    Hmm...Sad...Thanks for the help anyway. I guess I will just increase the size limit.
  16. Replies
    3
    Views
    1,610

    How do I increase the size of an array?

    I want to increase my array's size, which is declared as 3, to a size of 5.

    example :

    int test[3];

    I want to increase the array test size to 5

    test[5];
  17. How do I add an expression according to the user's input?

    How do I add an expression(modulus) according to how many digits user's input have?

    Example :

    If,

    User input : 5832 ( 4 Digit )

    4 digit = 4 modulus expressions
  18. Ah...got what you mean there...........Thanks...

    Ah...got what you mean there...........Thanks mate . . .
  19. Uhh.............. Well...It prints Y/N:Y/N: _...

    Uhh..............

    Well...It prints Y/N:Y/N: _ without that line...
    with that line , it prints Y/N: _

    x.x

    Guess I should go and get some sleep and figure it out when my brain's clear enough...
  20. Haha, still have hard time understanding what is...

    Haha, still have hard time understanding what is laserlight's concept in this line of code...So blur nooooooooow

    while
    ((c = getchar()) != '\n') /* intentionally empty */;




    #include...
  21. Hmm, it is not required but still, I will stick...

    Hmm, it is not required but still, I will stick to int, to prevent any nasty problems in the future :D
  22. Thanks for this! Will change it from now on.

    Thanks for this! Will change it from now on.
  23. Yeah, I tested it with a string of random...

    Yeah, I tested it with a string of random characters. It will still proceed like the input's all correct.
    What I mean by "difference" is, why his is working while mine not. I don't know the reason...
  24. Umm sorry , but I still don't quite understand...

    Umm sorry , but I still don't quite understand what this line "while ((c = getchar()) != '\n')" does...
    All I know is, while the user input is not enter..
  25. YES! Yours exactly solved what I want! Finally!...

    YES! Yours exactly solved what I want!
    Finally! If a user entered ridiculous answers, he's gonna get a slap from me! But still , besides that I used while loop to check the condition while you used...
Results 1 to 25 of 85
Page 1 of 4 1 2 3 4