Search:

Type: Posts; User: cprogbiginner

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    1,298

    anyway, thanks for helping!

    anyway, thanks for helping!
  2. Replies
    5
    Views
    1,298

    How to get integer from string???

    #include<stdio.h>
    #include<stdlib.h>

    int main(void)
    {
    unsigned number1, number2;
    char aString = "5.55";

    /* ?????????????????????????????? */
  3. Replies
    1
    Views
    1,568

    Unable to assign int to string. HELP!

    #include <stdlib.h>
    #include <stdio.h>

    int main(void)
    {
    char newString[] = "00000";
    int a = 0;

    a = 8;
    newString[1] = a;
  4. Thanks everyone! Here is the best place for...

    Thanks everyone! Here is the best place for learning! :)
  5. I've tried it like that: price = 4.10;...

    I've tried it like that:

    price = 4.10;
    tempPrice = (int) (price * 100);

    but the result are:

    Price: 4.10
  6. What if the 4 is pass to a function as 4.10? can...

    What if the 4 is pass to a function as 4.10? can i just multiply it 4.10 * 100 then store it as int?
    After that only do something like the code provided?
  7. Sorry that i don't really understand. Anyone can...

    Sorry that i don't really understand. Anyone can please explain it to me? Any solution to it? Thanks!
  8. Unusual weird result when casting double to unsigned.

    Please help! I don't understand why tempCents = 10.00, but when it cast to unsigned, it become 9? WHY? :confused:
    This only happen if the price = 4.10; If i change it to 3.10, the unsigned cents...
  9. Thanks everyone for fast reply. Actually i use...

    Thanks everyone for fast reply.
    Actually i use fscanf() to read data from a file eg. '234'

    data in a file doesn't have any type right?
    how can i validate that '234' is a unsigned type?

    if...
  10. Thanks!

    Thanks!
  11. How to check a variable to make sure it is the correct data type?

    I have checked out lots of sources from the internet but i cant find the exact way how to do it.

    But i do found something like this:




    #include <iostream>

    int main()
  12. May i know which conversion character should i...

    May i know which conversion character should i use to get an double from file? %f? eg. 4.60
    how about print? %.2f?
  13. Thanks Zuk/Kurt! It works perfectly!

    Thanks Zuk/Kurt! It works perfectly!
  14. Oh! It rings a bell! So i should use %[^|]|...

    Oh! It rings a bell!
    So i should use %[^|]| instead of %s|
    am i right?
  15. #include #include int...

    #include <stdio.h>
    #include <string.h>


    int main (int argc, char** argv)
    {
    char itemNo[5+1];
    char name[25 + 1];
    char itemDescription[250 + 1];
    char itemType;
  16. Cool! Thanks alot! Am trying to apply to my code....

    Cool! Thanks alot! Am trying to apply to my code. I tried it on small program, it works. Must be some other problem with my code.
  17. At first i use | as the delimiter in the data...

    At first i use | as the delimiter in the data file. It doesnt work. After i change it to comma, it works.


    before: (doesn't work)

    "%[^|]|%[^|]|%u|%u\n"

    Cadbury|Picnic|350|2
  18. Unable to use fscanf to read data from file

    Please help, im a beginner in c programming.
    What i thought is %[^|] will accept anything before a |, but it doesnt work.




    while(fscanf(sptr, "%[^|]|%[^|]|%u|%u\n", brand, name, &price,...
Results 1 to 18 of 19