Search:

Type: Posts; User: derek tims

Search: Search took 0.00 seconds.

  1. Reading all the numbes from a file and storing in an array

    is there an easy command to read from a file all the numbers which are stored in the file.

    lets say we have the file arraydata.dat:




    3 929 942.3 -2 0 28 92

    //and so on.......
  2. Replies
    13
    Views
    1,346

    daved: basically, the code i was given did work...

    daved: basically, the code i was given did work ok. but i sometimes needed to press ENTER more than once to go to the next step. so fiddling around with it i tried a few combinations, and what i have...
  3. Replies
    13
    Views
    1,346

    it works......... no matter what i do, it...

    it works.........

    no matter what i do, it seems to work fine.

    type 0 in starihgt away, works fine.

    type in any garbage in, press enter, get the please re-enter, enter 0, and it works.
  4. Replies
    13
    Views
    1,346

    thanks for the help!! here's what i've come up...

    thanks for the help!!

    here's what i've come up with, and it seems to work.




    cin >> a;
    z = a; // setting z = a, and so can later allow an input of zero.
    // without this, it would...
  5. Replies
    13
    Views
    1,346

    !(a) means not equal to a. do u mean that for...

    !(a) means not equal to a.

    do u mean that for boolean, if false it is always 0, and if true always 1?

    so from what i gather, by setting a = 0, it will appear to be false.
  6. Replies
    13
    Views
    1,346

    Can a float be zero?

    basically, in my program, i want to enter ANY number, including 0. if i enter anything other than a number, it will ask to re-enter.

    BUT, when i enter 0, it asks me to re-enter, yet 0 should be...
  7. Replies
    13
    Views
    1,283

    thank you VERY much!! have (i think sorted...

    thank you VERY much!!

    have (i think sorted it. so much easier than what i was trying to do!! :) )
  8. Replies
    13
    Views
    1,283

    its when i input q that i want to check. ie. ...

    its when i input q that i want to check.

    ie.




    cin >> q;

    check q for any chars, if so, then fail.
  9. Replies
    13
    Views
    1,283

    i have never used cin.getline before........ how...

    i have never used cin.getline before........ how would i go about using it?
  10. Replies
    13
    Views
    1,283

    checking a string for a char

    basically, i'm asking for a number of strips, and so this has to be an integer.

    now what i have done is made it so that when u enter the number of strips, it saves it as a string in a file.
    ...
  11. Thread: Or

    by derek tims
    Replies
    11
    Views
    1,307

    i have figured it. i've been editing in a dos...

    i have figured it. i've been editing in a dos window previously, and the || won't work.

    opening it up in notepad, and trying that works just fine.

    glad that's sussed!! thanks for the advice. :)
  12. Thread: Or

    by derek tims
    Replies
    11
    Views
    1,307

    i think it may be my version i'm running. just...

    i think it may be my version i'm running. just downloaded a piece of source code that had the || in it, and it failed to compile.

    i'm running the free borland 5.5 version.
  13. Thread: Or

    by derek tims
    Replies
    11
    Views
    1,307

    oops...... how silly. of course it is enclosed...

    oops...... how silly. of course it is enclosed within an if statement. i will edit the post for more accuracy.
  14. Thread: Or

    by derek tims
    Replies
    11
    Views
    1,307

    if i really need to post my code then of course,...

    if i really need to post my code then of course, i will.............

    but, i'm not sure if it'll make the slightest difference a its fairly long. i would just like to be able to use the or...
  15. Thread: Or

    by derek tims
    Replies
    11
    Views
    1,307

    Or

    i using borland c++ version 5.5, and when trying to do the or operator, which is denoted by ||, it says the symbol | is an illegal character.

    I'm presuming this to mean i don not have the correct...
  16. ok, well what i have done is when i enter n, i...

    ok, well what i have done is when i enter n, i store that value as a string.

    now then, i read from that file, an integer q, and read the same value, a float p.

    then i set up a while loop saying...
  17. ok, this is what i have. apologies for incorect...

    ok, this is what i have. apologies for incorect formatting, i'm new to this. i'm having to go out in a few minutes so i won't reply for a while either.




    #include <iostream.h>
    #include...
  18. slymaelstrom: yes, but for some reason it...

    slymaelstrom: yes, but for some reason it wouldn't work when i entered a float.

    no idea why. prob me!!

    but it worked for when i entered a character, just not a float, and it needs to be a float.
  19. sorry, n is an integer.

    sorry, n is an integer.
  20. Check for an integer, fail if anything else

    I'm working on an integration program, that works out the integation by approximating with the rectangle rule.

    I am trying to ask how many strips do you want? This MUST be an integer, yet if i...
  21. Thread: Not a float

    by derek tims
    Replies
    3
    Views
    852

    awesome..... thanks. :)

    awesome..... thanks. :)
  22. Thread: Not a float

    by derek tims
    Replies
    3
    Views
    852

    Not a float

    What i am trying to do is to set a value for a. the value should be a number (float).

    but i need to make it so that if a char is entered, then the program will end, or say something like "this is...
  23. Replies
    2
    Views
    740

    ok, thanks for the advice. i think i will give...

    ok, thanks for the advice. i think i will give the parser a miss!!

    it wasn't asked of me, i just thought it would be good to have it though, but its probably not worth it.

    i will have a quick...
  24. Replies
    2
    Views
    740

    Reading\Writing a function from a file

    Basically, what i am trying to do, is write a program that will integrate a function using the rectangle method.

    I'm fine with the maths part.

    And i can declare a function within the actual...
Results 1 to 24 of 25