Adara Starr 94
David Starr 91
Sophia Starr 94
Maria Starr 91
Danielle DeFino 94
Dominic DeFino 98
McKenna DeFino 92
Taylor McIntire 99
Torrie McIntire 91
Emily Garrett 97
Lauren Garrett 92
Marlene Starr 83
Donald DeFino 73
This is the code I have so far:
// David Freed
#include <iostream>
#include <fstream>
using namespace std;
const int MAXNAME = 20;
int main()
{
ifstream inData;
inData.open("grades.txt");
char name[MAXNAME + 1];
float average;
inData.get(name,MAXNAME + 1);
while(inData)
{
cout << "The name of the student is: " << name << endl;
inData >> name;
inData.get();
cout << "His or Her average is: " << average << endl;
inData >> average;
inData.get();
}
return 0;
}
It will give me random averages, and will stop after the first person.
Chat with our AI personalities
read: moving data from file to memory write: moving data from memory to file
The class I find useful is the FileReader class in java.io. It allows you to read an external file in your program.For instance,Consider a file input.txt:HelloHow are you?1 2 3 4 5You can access it by:FileReader read = new FileReader("input.txt"); // pass the file name as a String//now the read is the file//can scan from the file using ScannerScanner scan = new Scanner(read);System.out.println( scan.nextLine()); // prints HelloSystem.out.println( scan.nextLine()); // prints How are you?while(scan.hasNextInt())System.out.print(scan.nextInt() + " "); // prints 1 2 3 4 5
Ubuntu supports a large number of file systems, including ext2 (read/write), ext3 (read/write), ext4 (read/write), ReiserFS (read/write), JFS (read/write), XFS (read/write), FAT (read/write), and NTFS (read, additional software available for writing). With the exception of NTFS, it can also boot off of the above file systems.
you can use inputstream for reading the file java.io.fileinputstream and write the file using outputstream..
FileReader used to read the character stream in the file.i.e a file that contanis only the character means FileReader is the choice to read the file.On the other hand if the file contains image,byte like raw data format means FileInputStream is the choice to read the data in the file,.