Thread: help!input data from files?!?

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    1

    Question help!input data from files?!?

    I have to make a program that inputs reads information off of a file. Its of student grades, and i have to compute the average of each student for each test and then the average test score for each test. I am having a problem with the averages bc they are all coming up as zeros i do not know what i am doing wrong...help!

  2. #2
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    read the faq....like the rules say.

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Post your code.

  4. #4
    Registered User
    Join Date
    May 2002
    Posts
    74
    Kristi,

    This is part of program I am currently working on. It reads 5 integers from a file called sample.txt, and puts the data in v1, v2, v3, v4 & v5. Is this what you were looking for??

    Code:
    	BigInt v1, v2, v3, v4, v5;
    
    	ifstream in;
    
    	in.open("sample.txt");
    
    	in >> v1 >> v2 >> v3 >> v4 >> v5;

  5. #5
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    the awsome things we find if we follow the rules!

    http://cboard.cprogramming.com/showt...&threadid=3700

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Storing and accessing data from and to .txt files.
    By Glauber in forum C++ Programming
    Replies: 9
    Last Post: 05-27-2008, 02:59 PM
  2. reading formatted data files
    By gL_nEwB in forum C++ Programming
    Replies: 5
    Last Post: 04-22-2006, 10:09 PM
  3. Adding files of numerical data
    By Boucho in forum C Programming
    Replies: 4
    Last Post: 02-06-2006, 05:27 PM
  4. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM
  5. C diamonds and perls :°)
    By Carlos in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-16-2003, 10:19 PM