file seekg

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • greek
    New Member
    • Nov 2006
    • 17

    file seekg

    Hi
    I have to write a prg for the following question..

    A file carsale_june.tx t stores the number of small and medium-sized of cars sold in the month of June by a car company. The first line of carsale_june.tx t is an integer that indicates the number of carsalemen working in the company. Each row afterwards consists of three data items, namely, the saleman employee id, followed by the number of small-sized and medium-sized cars he sold. A typical carsale_june.tx t file is as follows:

    4
    01107 10 6
    08821 5 8
    96512 14 6
    23115 20 3

    Write a program that uses the carsale_june.tx t file to print the average number of cars sold in June and the id of the carsaleman who makes a sale higher than the average.


    i can create the file then how wat do i do? i think i have to use seekp and seekg koz the 2nd and 3rd column is for number of cars sold
    how do i use seekp or seekg? can sumbody explain plzzz
  • sivadhas2006
    New Member
    • Nov 2006
    • 142

    #2
    Hi,

    You can read the values one by one like this.
    And do the calculation to satisfy your need.

    Code:
    fscanf(fpCarDetails, "%d%d%d", &nEmployeeId, &nSmallCars, &nMediamCars);
    And also first try to write the program and post it, if you faced any problem.

    Regards,
    M.Sivadhas.

    Comment

    Working...