PDA

View Full Version : in need of help


NotHisTechiness
11-20-01, 07:56 PM
ok, i'm trying to get the data from a .txt file and display the largest and smallest values from the .txt. the thing is, i don't know how to separate the data from the .txt file so it will display the data. also, the prices.txt is set so there's no need to take in account of variables other than the amount of characters. anywho, all and any help is appreciated and thanks in advance.

here's what i have so far:

#include <string.h>
#include <iostream.h>
#include <fstream.h>

void main()
{
char prices[30];

ifstream infile("prices.txt");
if (!infile)
{
cout << "Error Opening File" << endl;
exit (-1);
}
while (infile>>prices)

}

Krusty
11-20-01, 11:48 PM
well...you could look for a carriage return. i think you could also just read the data in 1 line ata time. i havent programmed in almost 2 years now and need to do a 3 hour refresher before giving any official information.