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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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