Question
Write a function readAndPrint, and power with parameters noted below in the Functions.h file. #ifndef FUNCTIONS_H #define FUNCTIONS_H #include #include #include using namespace std; /*reads
Write a function readAndPrint, and power with parameters noted below in the Functions.h file.
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
#include
#include
#include
using namespace std;
/*reads from a file
and prints every item to the screen*/
// file contains sets of
//int
//string
//Don't forget to use infile.ignore() between << and getline
//ifstream must be passed by reference
void readAndPrint(ifstream &infile);
//uses a for loop to return the base to the exponent
//e.g. 2^4 = 16
long power(long base, long exponent);
#endif
You should place the function prototypes in a file called Functions.h The function prototype has a semi-colon at the end. e.g
Then you should implement in a file called Functions.cpp
Finally, declare the infile, and call the readAndPrint function. Then look at the power of 2^3 and 10 ^ 4
Create a file with nano that has the following information.
1
Alpha
2
Beta
3
Gamma
Your functions.cpp AND your lastnamefirstLab05b.cpp should
#include Functions.h.
Remember that you should not #include.cpp files!
Implementation detail 4: compile and run with:
g++ -o lab05b yourlastnameLab05b.cpp Functions.cpp
run with:
./lab05
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started