n the starting-code below, <string> is not #included, but <cstring> is. You should also #include <string>. <cstring> is only included in case you want to use strlen("_photo.jpg"). It's up to you whether you want to use that.
A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names.
Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output.
Ex: If the input of the program is:
ParkPhotos.txtand the contents of ParkPhotos.txt are:
Acadia2003_photo.jpg AmericanSamoa1989_photo.jpg BlackCanyonoftheGunnison1983_photo.jpg CarlsbadCaverns2010_photo.jpg CraterLake1996_photo.jpg GrandCanyon1996_photo.jpg IndianaDunes1987_photo.jpg LakeClark2009_photo.jpg Redwood1980_photo.jpg VirginIslands2007_photo.jpg Voyageurs2006_photo.jpg WrangellStElias1987_photo.jpgthe output of the program is:
Acadia2003_info.txt AmericanSamoa1989_info.txt BlackCanyonoftheGunnison1983_info.txt CarlsbadCaverns2010_info.txt CraterLake1996_info.txt GrandCanyon1996_info.txt IndianaDunes1987_info.txt LakeClark2009_info.txt Redwood1980_info.txt VirginIslands2007_info.txt Voyageurs2006_info.txt WrangellStElias1987_info.txt#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
int main() {
/* Type your code here. */
return 0;
}
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images
- Click cell C9 and insert a VLOOKUP function that looks up the code in cell B9, compares it to the codes and types of art in the range B2:C6, and returns the type of art. Copy the function in cell C9 to the range C9:C54. Hide column B that contains the codes.arrow_forwardWrite a function named copyInput that that doesn't take any parameters and doesn't return a value. This function should find an HTML element with an id of "user_input". That element will be a text box (input element). Update the division (div element) with an id of "update_me" so that the div displays the text box's value..arrow_forwardThis is the program i have been given. I have to change it to meet the following criteria but can only change the body of the show_flashcard function # IMPORTANT# Q2 (a)(iii) Make changes only to# -- the docstring for the program as a whole.# -- the docstring of the show_flashcard() function# -- the body of the show_flashcard() function. def show_flashcard(): """ Show the user a random key and ask them to define it. Show the definition when the user presses return. """ random_key = choice(list(word_list)) print('Define: ', random_key) input('Press return to see the definition') print(word_list[random_key]) # Set up the word_list word_list = {'black':'noir', 'red':'rouge', 'yellow':'jaune', 'orange':'orange', 'white':'blanc', 'green':'vert'} # The interactive loop exit = Falsewhile not exit: user_input = input('Enter s to show a flashcard and q to quit: ') if user_input == 'q':…arrow_forward
- Hi, can you help me with the indentation in this code, please. import csv# Define global variablesstudent_fields = ['ID', 'name', 'courses', 'absences', 'm1', 'm2', 'm3', 'total']student_database = 'students.csv'def display_menu():print("--------------------------------------")print(" Welcome to Student Management System")print("---------------------------------------")print("1. Add New Student")print("2. View Students")print("3. Search Student by iD")print("4. Search Student by courses")print("5. Delete Student")print("6. Quit")def add_student():print("-------------------------")print("Add Student Information")print("-------------------------")global student_fieldsglobal student_databasestudent_data = []for field in student_fields:value = input("Enter " + field + ": ")student_data.append(value)with open(student_database, "a", encoding="utf-8") as f:writer = csv.writer(f)writer.writerows([student_data])print("Data saved successfully")input("Press any key to continue")returndef…arrow_forwardQuestion 11 mah design team wants to get more attraction to our page and decided to experiment with the title of our page. We want to capitalized the first three character of each title. Create a function **capitalizeThreeLetters** that takes in one parameter, a string representation of a word, and outputs the same string with the first three characters capitalized. Please use the below lines to check the work: console.log(capitalizeThreeLetters('welcome')); // => should return 'WELcome'console.log(capitalizeThreeLetters('codesmith')); // => should return 'CODesmith'arrow_forwardHow do we add text, shapes, and other annotations to Matplotib piots? O By passing an indcator variable indicating the quadrant of the gyraph for annotation to the correspor function or method By passing the (xy) coordinates to the corresponding function or method O By passing the asis labets for each object to the corresponding function or method O By passing a lst of strings to the corresponding function or methodarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education