Write a program that is supposed to read data from a file

Assignment Help Computer Engineering
Reference no: EM132107347

Question :

You have a program that is supposed to read data from a file. The file contains products and their quantities. I can't get the function to read the data and display it.

This is what I've done and it displayed a lot of errors. #include #include #include using namespace std; void readData(ifstream[], int); int main() { const int size = 30; ifstream infile; infile.open("prog1.txt"); string item; //location; int qty; //double price; if (!infile) { cout << "File cannot open!" << endl; exit (1); while (!infile.eof()) { readData(infile); } return 0; } void readData(ifstream infile[], int size) { for (int index = 0; index > size; index++) { getline (infile, item); infile >> qty[index]; } infile.close(); } }

Reference no: EM132107347

Questions Cloud

Find the probability that the second roll : Let A denote the event that a 1 is obtained on the first roll, and let B denote the event that an even is obtained on the second roll. Find P(A and B).
Perform the while loop logic read in a number that be lcv : Write an assembler program that will perform the 'while loop' logic read in a number that will be your LCV (loop-control-variable).
Deck of cards without replacement : Suppose two cards are selected from a deck of cards without replacement (a deck has 52 cards). How many outcomes are in the sample space S?
What is the probability that the rate of return on stock : What is the probability that the rate of return on this stock was at least 5%?
Write a program that is supposed to read data from a file : You have a program that is supposed to read data from a file. The file contains products and their quantities.
Write a java program that asks the user to enter two times : This program should have two classes, substing, parsing . Write a Java program that asks the user to enter two times.
Estimate the true proportion of all employees : Construct a 95% confidence interval to estimate the true proportion of all employees at this workplace who were satisfied with their position.
Implement and tests the given two functions : Write a c++ program that implements and tests the following two functions related to the Calkin-Wilf enumeration of the positive fractions.
Sample space outcomes forming a sample space : Let A,B,C,D, and E be sample space outcomes forming a sample space.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Make use of a for loop to step through all 32 bits

The bitwise-manipulation operators perform simultaneous bit manipulations and enable programs to process large quantities of binary information well.

  Generate the necessary data flow diagrams for your system

We Are Parties, INC is using a paper based system to keep track of the supplies ordered for events and the location of events they cater.

  Identify tasks that can be assigned to the faculty members

Identify tasks that can be assigned to the faculty members that will allow them to use task-parallelism when they prepare for the party.

  Propose a ip network scheme to accommodate the needs

Propose a IP network scheme to accommodate the needs of the office above. Your proposal should incorporate the most efficient use of network/host using VLSM and a second option using FLSM. Provide pluses and minuses for each option.

  What are the three categories of relationships in er diagram

When translating an ER diagram to the relational model, do all relationships end up as relational model? Explain your answer.

  How many prefetches need to be outstanding

How many prefetches need to be outstanding

  Create an interface that lets you enter a description

Create an interface that lets you enter a description of your Java lab assignments and the grades you receive, storing them in a file on your floppy disk.

  What is the worst-case delay for acknowledging an interrupt

What is the worst-case delay for acknowledging an interrupt

  Research best practices for system integration approaches

1.research best practices for system integration approaches such as the systems development life cycle sdlc approach

  Write down a program that inputs a word

Write down a program that inputs a word from the keyboard and determines the length of the word. Print the word using twice the length as the field width.

  What will the permissions string look like for octal values

How will you save the complete listing of all files and directories in the system? What will the permissions string look like for these octal values?

  Explain basic principles of the socio-technical approach

Cite real-world experiences to draw direct connections to the theories. create a note of the social circumstances that relate to the concepts presented by the theories.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd