Find Jobs
Hire Freelancers

Programming Exercise 4 – (Voltage)

$10-30 USD

Cancelled
Posted about 9 years ago

$10-30 USD

Paid on delivery
In the programs folder in your home directory on onyx, create a new directory called p4. Your program must compile without any warnings in this directory, and you must submit your completed program from there. For this assignment, write a program that calculates the voltage in an electric circuit given the value of the current and the resistance of that circuit. Your program will read in the currents and resistances from a data file that will be provided by the user on the command- line. A data file will contain exactly ten pairs of current / resistance values. After reading in the current and resistance values, your program will calculate the voltage of each pair and print a table with these values.  Your program should decomposed into at least three different functions: one to read in the current and resistance values, one to calculate the voltages, and another to print out the values. You should declare arrays to hold the data in your main() function, and pass you them as parameters to the functions as needed. You should also open and close your data file in main() and pass it to the appropriate function for processing. In order to read in the current and resistance data, as well as to calculate the voltages and to print out the table of values, your program should not use the array bracket syntax (i.e. anArray[i]). Instead, your program should use only pointers. You will have to declare each array using the array syntax, but nowhere else in your program should it be used. 4 Files For this programming exercise, you are only required to turn-in two files. The first file contains your source code and is called voltage.cpp. Be sure to save your file under this name with no capitalization. Files not named this will have points deducted. The other file you should submit is your README file, which should have no file extension. Again, points will be deducted for README files named incorrectly. To compile your source code, you should use the provided makefile. Simply copy the makefile into your p4 directory and type make on the command-line. This command will compile your file and create an executable file called voltage, assuming there are no compilation errors. You are also provided with a sample data file, test.dat. In this file, as well as in any files used to test your program, the current and resistance values for a given circuit are stored on one line. For example, the first few lines of [login to view URL] contain this information: 10.62 4 14.89 8.5 13.21 6 ... where 10.62 and 4.0 are the current and resistance values for the first circuit, respectively, 14.89 and 8.5 are the same values for the second, etc. 5 Sample Output For your program to work properly, it must execute using the following syntax: ./voltage [ filename ] where filename is the name of the file with the circuit data. For instance, if the data file is called [login to view URL], the command-line syntax would be: ./voltage [login to view URL]
Project ID: 7458279

About the project

5 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
5 freelancers are bidding on average $55 USD for this job
User Avatar
I am very proficient in c, c++. I have 15 years c++ developing experience now, and I have worked for 5 years. My work is online game developing, and mainly focus on server side, the language is c++ under linux. I used c++ to make many great projects, for example, I made the tools which can convert java files to c++ scripts which has the same effect, of course garbage collection included. I also made our own mobile game using c++, I even can show you the demo of client. Trust me, please let expert help you.
$100 USD in 2 days
4.8 (45 reviews)
5.8
5.8
User Avatar
A proposal has not yet been provided
$30 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
A proposal has not yet been provided
$30 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
it will done on time without any delay and without any more budget and will be made as it required ..
$90 USD in 3 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
BOISE, United States
5.0
27
Payment method verified
Member since Feb 20, 2015

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.