answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you read in the names and averages from this file?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is meant by read and write txt in file handling?

read: moving data from file to memory write: moving data from memory to file


How do you read from an external file in java?

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


What file systems does Ubuntu support?

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.


How do you read and write video file in java?

you can use inputstream for reading the file java.io.fileinputstream and write the file using outputstream..


What is the difference between File Reader and FileInputStream in java?

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,.

Related questions

How do you read a dump file?

pick up a file from a dustbin and read it,,,,a file in a dustbin is known as dumb file...


What are typical access rights that may be granted or denied to a particular user for a particular file?

Read, write, execute, and functions in software objects.


How do you use cwcheat?

You read the Read Me file.


How do you change a read only file into a read write file?

To change a read only file into a read write file, first find the file to be edited. Then right click the file and click on properties. Next, click the general tab and clear the read only check box. Lastly, click on the OK button.


How do you read a pdf file on mobile?

Upload the pdf file to Google Doc,and read that throught that! Or install some software that can read it!


What is meant by read and write txt in file handling?

read: moving data from file to memory write: moving data from memory to file


Can a file with a weird extension but with batch file code be read using another batch file?

Nope, the format of a file is a vital part of a successful batch file. Even if a file with an unknown file format contains working batch file code in it, a batch file will still not be able to read it because of its foreign file extension. If you want the batch file to be able to read the foreign file, then you can set it to rename the mutated file to .bat format and then read it for it to work. Example: @Echo off REN File.Foreign File.bat CALL File.bat exit


What is a compatible file?

A compatible file is a file name extension (or format) that a program can read.


How to verify the ntfs and folder permissions?

NTFS File Permission Allows the User To Full Control Change permissions and take ownership, plus perform the actions permitted by all other NTFS file permissions Modify Modify and delete the file plus perform the actions permitted by the Write permission and the Read & Execute permission Read & Execute Run applications plus perform the actions permitted by the Read permission Read Read the file, and view file attributes, ownership, and permissions Write Overwrite the file, change file attributes, and view file ownership and permissions


What function will read a specified number of elements from a file in c?

fread() function will read a specified number of elements from a file .


What type of video file does the R4 read?

video file and R4?


What is function of End-of-file?

It means 'no more data to read in this file'.