Load in the household configuration file

Assignment Help C/C++ Programming
Reference no: EM13812886

The first thing the program is required to do is load in the household configuration file, with the following filename:
housecfg.dat

If the file is not found, or there are any errors in reading the file data, the program should report this and then terminate.
The data contained in the file should be loaded into an array of structures. The array should be declared in the main function, although the file load should have a function of its own. Note that it is recommended to use dynamic memory allocation for this task, as static memory allocation will result in a loss of marks.

You may assume the file will follow the following format:
[Number of household devices]
[Unique Device ID]
[Device Name]
[Device Location]
[Device State]
...
...
[Unique Device ID]
[Device Name]
[Device Location]
[Device State]

The ... represents repeated intermediate devices.

The fields are described as follows:
[Number of household devices] - This is the total number of devices stored in the file
[Unique Device ID] - This is an integer identifier for the current device, useful for storing specific information about the device's state.
[Device Name] - This is a string specifying the name of the device. For example, this may be "TV".
[Device Location] - This is a string specifying the room of the house that the device is located in. For example, "Lounge" or "Dining".
[Device State] - This is an integer specifying the current state of the device. Note that for this assignment, we will only use two states; on and off.The on state is represented by a 1. The off state is represented by a 0.

Below is an example of a household configuration file:
2
0
TV
Lounge
0
1
Computer
Study
1
N.B. If the sample file is copied from windows into putty, the file newline formatting may be incorrect. Use the following command to change the format of the file from windows to Unix
dos2unix<filename>.

Attachment:- programing.rar

Reference no: EM13812886

Questions Cloud

The role of a us federal agency intelligence analyst : Written Threat Assessment: You are to assume the role of a US federal agency intelligence analyst who is putting together the agency's input (on your specific topic) for the DNI's Annual Threat Assessment, which will be presented to Congress. Therefo..
Describe how each element is implemented : Describe how each element is implemented
Describe how the historical development of policing : Describe how the historical development of policing in the United States relates to the current relationship between police and different ethnic groups and social classes.
Specialization in regard to security interests : Write a 1,050- to 1,400-word paper explaining the selected specialization, the role of the security manager, and the importance of the specialization in regard to security interests. Address the following questions:
Load in the household configuration file : The first thing the program is required to do is load in the household configuration file, with the following  filename: housecfg.dat
Find the acceptance rejection region h0 and determine if yo : Consider the following hypothesis test. H_0: μ ≥ 25 H_1: µ
Advantage of corporate form of business organization : Ques. 1) Which of the following is not an advantage of the corporate form of business organization?
Describe the customer problem : Describe the customer problem
What were the interests of the opposing parties : What were the interests of the opposing parties? Was the conflict an example of constructive controversy, consensus-seeking, debate, or something else? Explain.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Class to act as a generic array

Create a class to act as a generic array (i.e. the user will be able to choose the data type to be stored by passing the appropriate template argument.

  Using the hotelroom class of programming problem

Using the HotelRoom class of Programming Problem 1 , Section 12.4 , write a program that uses an array Hotel [ ] of 200 HotelRoom pointers to store information about a set of hotel rooms . The program should ask the user to ent information about a ro..

  Time conversion

Write a C++ program that takes an Eastern standard time in hours, minutes, and seconds,and prints it out in Central time, Mountain time, or Pacific time.

  Create a class named gamer that has a field for name

Create a class named Gamer that has a field for name(string) and a field for points(int).

  Program for compiler design in c

Write a Program for compiler design in c.

  Write function to find whether number is perfect number

Write down the function perfect which determines whether number is perfect number or not. This function must receive number and return true if number is perfect.

  Structured programming using procedural languages

A a program that is called "Playing with Numbers or Letters".

  Program that generates 50,000 random integers from 1 to 6

Program that generates 50,000 random integers from 1 to 6 (inclusive). Count the number of times that each number occurs and output the totals

  Generate a random number and guess what the number is

Prepare a program in c++ that generates a random number and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again."

  Need a program that has the user enter a string

Need a program that has the user enter a string. The program will test to see if its a exact palindrome like "civic" or "level". then it should test if its an inexact palindrome like "a nut for a jar of tuna".

  Write a research paper on flow of control

Write a two page research paper (excluding title and reference pages) on Flow of Control.

  Need c++ solution to cover the final stage of euro 2012

From Group Fase to elimination fases, it´s not the user who defines teams, because that must be made automatically according to classification in group fase - considering regulations.

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