Question: C++ code help; Write a program that reads in a series of names from a file The file is called names.txt . It uses a
C++ code help;
Write a program that reads in a series of names from a file
The file is called names.txt.
It uses a loop to read in each name from the file and store each name in an array called names.
The program should then call two functions.
The first function:
The function is named capitalize
It take in a string variable by reference
It alters the string variable so that it capitalizes all of the letters in the string
This function must use a for loop and an if statement. It cannot call any outside functions that we have not discussed in this class.
It returns nothing.
The second function:
The function is named print
It takes in an array of strings and an integer for the size of the array
It prints out the array using a for loop to the console
It returns nothing
The program will use a loop to call the capitalize function on each of the strings in the names array.
Once all of the strings are capitalized, call the print function to display each of the capitalized names.
Copy and paste the starter code below into a new file called capitalize.cpp
#include
//write your functions here
(don't change the basis code)
Copy and paste the below data into a file called names.txt:
Barbara Stanton Timoteo Martinez Grace Gu Xing Xiao Dung Kim Tanya White Alan Ngo Abir Fadel
Below is the output that your program should give:
BARBARA STANTON TIMOTEO MARTINEZ GRACE GU XING XIAO DUNG KIM TANYA WHITE ALAN NGO ABIR FADEL
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
