Search:

Type: Posts; User: SpEkTrE

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    12
    Views
    1,886

    as in cin.getline(tmp,100,'\n'); ? ...

    as in


    cin.getline(tmp,100,'\n');


    ?

    or can i bypass the buffer and go with
  2. Replies
    12
    Views
    1,886

    linked list/ stored data

    i trying to read a line of users input and store that information. My problem is that when the data is being read it has a problem with the spaces.




    struct link_list
    {
    char...
  3. Replies
    1
    Views
    1,455

    reading data from the users input

    First off, please excuse the fact that there is some syntax of C in here...(i'm trying something)

    I'm trying to read a line of data, that the user enters, and then store it into a linked list...
    ...
  4. Replies
    2
    Views
    1,079

    case error with linked list

    I'm having an error when using a linked list. I'm simply trying to have a list where you can create...add...delete..etc...

    But in my case statement I receive.....



    initialization of 'l1' is...
  5. Thread: swap function

    by SpEkTrE
    Replies
    8
    Views
    5,899

    void alpha(struct employee *records); ......

    void alpha(struct employee *records);
    ...
    main()....
    ....



    void alpha(struct employee *records)
    {
    for(int n=1; n<= 13; n++)
  6. Thread: swap function

    by SpEkTrE
    Replies
    8
    Views
    5,899

    swap function

    I'm having trouble with my swap. I'm just trying to compare strings and swap them.




    for(int n=0; n<= 13; n++)
    for (int i=0; i<= 13; i++ )
    {
    int j=i+1;
    ...
  7. Replies
    10
    Views
    1,612

    yes you are right, I was tweaking numbers around...

    yes you are right, I was tweaking numbers around and never changed that one...thanks
  8. Replies
    10
    Views
    1,612

    oh boy... :( for (i=0;i

    oh boy... :(



    for (i=0;i<=14;i++);
    do{
    fgets(tmp,200,fPtr);
    sscanf(tmp, "%d %s %f %d", &records[i].id, &records[i].name, &records[i].pr, &records[i].csalary);
    }
  9. Replies
    10
    Views
    1,612

    yes I know, our teacher says he doesnt matter...

    yes I know, our teacher says he doesnt matter what we code in. So the headers are basically a default for most programs...
  10. Replies
    10
    Views
    1,612

    is the data being read?

    I compile my program and it compiles fine...but when I run it..I come up with zero's for all integers and blanks for strings...

    can anyone see anything wrong? I at my wits ends and now wondering...
  11. Replies
    17
    Views
    3,811

    I've moved the fgets and the sscanf into my main...

    I've moved the fgets and the sscanf into my main function...but I'm still having zeros as output...



    main()
    {
    char buf[100];
    struct employee records[14];
    int i=0;
    FILE *fPtr;
  12. Replies
    17
    Views
    3,811

    If the file has been succesfully opened the...

    If the file has been succesfully opened the function will return a pointer to the file. Otherwise a NULL pointer is returned

    i.e.

    return fPtr;

    :rolleyes: ?
  13. Replies
    17
    Views
    3,811

    I'm almost there... But I believe it is not...

    I'm almost there...

    But I believe it is not reading the data from the first file. Mainly because I have output of zero's. I did try to place a print statement just after the fgets and the...
  14. Replies
    17
    Views
    3,811

    calm down there killer..i just didnt want to post...

    calm down there killer..i just didnt want to post the whole code...but here it is..

    FYI: trail.txt is a file that consist of employee's





    ...
  15. Replies
    17
    Views
    3,811

    struct employee { int id; char...

    struct employee
    {
    int id;
    char name[10];
    float pr;
    int csalary;
    int raise;
    double rate;
    int nsalary;
    };
  16. Replies
    17
    Views
    3,811

    that seem to have worked, now I have another...

    that seem to have worked, now I have another error..



    error C2228: left of '.csalary' must have class/struct/union type



    from here ..
  17. Replies
    17
    Views
    3,811

    cannor convert parameter...

    I'm having this error occur and I'm not sure how to resolve it...



    error C2664: 'readfile' : cannot convert parameter 1 from 'employee [14]' to 'int *'


    here is where it is pointing to...
  18. Replies
    16
    Views
    2,326

    i was thinking of using this...while it is still...

    i was thinking of using this...while it is still reading...



    int i, pass, hold;
    for (pass = 0; pass <=13; pass++)
    for (i=0; i<=11; i++)
    if (records[i] >...
  19. Replies
    16
    Views
    2,326

    I believe I'm with you so far... ...

    I believe I'm with you so far...



    fgets(buf,200,fPtr);
    sscanf(buf, "%d %s %f %d", &records[i].id, &records[i].name, &records[i].pr, &records[i].csalary);

    is it safe to...
  20. Replies
    16
    Views
    2,326

    isnt that this... struct employee { int...

    isnt that this...


    struct employee {
    int id;
    char name[10];
    int pr;
    int csalary;
    int raise;
    double rate;
  21. Replies
    16
    Views
    2,326

    now that I have the reading of the file done......

    now that I have the reading of the file done... How can I arrange alphabetically by name?




    //#include <iostream>
    #include <stdio.h>

    //using namespace std;
  22. Replies
    16
    Views
    2,326

    understood! Now I see that the my char buf...

    understood!

    Now I see that the my char buf will hold for example the first line...

    now I need to use sscanf to break that line up into variables? i.e. id, name, pr, salary?


    fyi:
    here is...
  23. Replies
    16
    Views
    2,326

    I think I understand why I should not use fread,...

    I think I understand why I should not use fread, thanks

    And I know fgets reads an entire line...but how would I write that?

    fgets(?,100,fPtr);


    :confused:
  24. Replies
    16
    Views
    2,326

    ok gettin back to the core of the problem... ...

    ok gettin back to the core of the problem...


    why is this not showing any output? :confused:



    //#include <iostream>
    #include <stdio.h>
  25. Replies
    16
    Views
    2,326

    help w/ program

    Hello all

    I need some help with my program. Here is the jist of it. I need to write a program that pulls data from another (i.e. employee id, name, performance rating, and current salary)
    ...
Results 1 to 25 of 54
Page 1 of 3 1 2 3