Write a C++ program that combines the content of the two inputs files, ip1.txt and ip2.txt and writes the combined data into an output file name op.txt. Each line of op.txt contains the student name from ip1.txt and GPA from ip2.txt as follow:
LastName, FirstName / GPA
Note: assume the contain in ip1.txt:
FirstName LastName
The program must read ip1.txt and ip2.txt until it reach the end of file.
CODE:
#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int a=0,n=0;
ofstream file2;
fstream file,file1;
double gpa[10],marks;
string word, firstName[10],lastName[10],
filename,filename1;
filename = "ip1.txt";
//opening the file ip.txt
file.open(filename.c_str());
//reading word by word
while (file >> word)
{
//reading first name
if(a == 0){
firstName[n] = word;
a = 1;
}
//reading second name
else if(a == 1){
lastName[n] = word;
n++;
a = 0;
}
}
//opening a file ip2.txt
filename1 = "ip2.txt";
file1.open(filename1.c_str());
n=0;
//storing the gpa read from the filr
while(file1>>marks){
gpa[n] = marks;
n += 1;
}
//opening the output file
file2.open("op.txt");
//printing the derails in the output file
for(int i =0;i<n;++i){
file2<<lastName[i]<<","<<firstName[i]<<"
/"<<gpa[i]<<endl;
}
//closing the opened files
file2.close();
file.close();
file1.close();
return 0;
}
______________________________
Refer to code images for indentation

_____________________________
OUTPUT and INPUT Files:
ip1.txt

Peter Parker
Danny Morison
Kevin Peterson
Bob Marley
Stuart Broad
Karl Marx
_______________________________________
ip2,txt:

8.2
7.6
9.4
6.1
8.3
7.8
_____________________________________
OUTPUT File:
______________________________________
Feel free to ask any questions in the comment section if
required
Thank You!
Write a C++ program that combines the content of the two inputs files, ip1.txt and ip2.txt...
in c prog only please!!
Name this program one.c - This program takes two command line arguments: 1. an input filename 2. a threshold Your program will create two files: 1. even.txt - contains all integers from the input file that are even and greater than the threshold 2. odd. txt - contains all integers from the input file that are odd and greater than the threshold • The input file will exist and only contain a set of integers....
JAVA 6. Create two files and name them: puzzle.txt and puzzle2.txt Inside puzzle.txt, write the following text: MWTaahyiebt_e,c__hnyaoontuc;'e_rste_r_aynr_oert_e_gasoduoipdnp_got_shoeandtl__yty_oot_uhrree__apTdrH_oItgRhrDia_sml__eowtnotere.kr_ss_. Inside puzzle2.txt, write the following text: WTTohhriikssi__niigss,___ttbhhueet___wryrioogunh'gtr__emm_eessshssoaawggieen__gff_rrtoohmme___sswaarmmoppnllgee_22o..nttexxstt Open a file specified by the user. This file will contain a bunch of characters. You should read in each character from the file, one character at a time. Display every third character on the screen. Throw the other characters away. There is a sample input file called puzzle.txt, containing a little message you can...
Please don't use a void fuction and this is a c++ question.
Thanks
Write a program that reads two input files whose lines are ordered by a key data field. Your program should merge these two files, writing an output file that contains all lines from both files ordered by the same key field. As an example, if two input files contain student names and grades for a particular class ordered by name, merge the information as shown below Using...
In C++, Write a program that retrieves a phone number from a txt files of names and phone numbers. The program should ask the user to enter a name and then print the phone number of that person (or vice versa, number into name) The program should allow the user to repeat the operation as often as they would like to. The data is contained in two text files named "phoneNames.txt" and "phoneNums.txt". The files have one name or one...
C++.Write a program that opens two text files and reads their contents into two separate queues. The program should then determine whether the files are identical by comparing the characters in the queues. When two nonidentical characters are encountered, the program should display a message indicating that the files are not the same. If both queues contain the same set of characters, a message should be displayed indicating that the files are identical. Sample Run Suppose we have two files...
Write a python program that prompts the user for the names of two text files and compare the contents of the two files to see if they are the same. If they are, the scripts should simply output “Yes”. If they are not, the program should output “No”, followed by the first lines of each file that differ from each other. The input loop should read and compare lines from each file. The loop should break as soon as a...
Python Assignment Tasks 1. Place the two provided plaintext files (file_1.txt, file_2.txt) on your desktop. 2. Write a Python program named fun_with_files.py. Save this file to your desktop as well. 3. Have your program write the Current Working Directory to the screen. 4. Have your program open file_1.txt and file_2.txt, read their contents and write their contents into a third file that you will name final.txt . Note: Ponder the open‐read/write‐close file operation sequence carefully. 5. Ensure your final.txt contains...
Program in C Student Data using Structs In this assignment you will create a program (using multiple .c files) to solve the following problem: You have been hired by the university to create a program that will read in input from a .txt file. This input will contain a student name, student id #, their age and their current gpa. You should use the following struct for your student data: struct Student{ char name[50]; int id; float...
12.8 GPA reports using files This program is to compute and write to a file the GPA for student scores read from an input file. As in Lab 7.5, the point values of the grades are 4 for A, 3 for B, 2 for C, 1 for D, and 0 for F. Except for the grade A, where + has no effect, a + after the letter increases the point value by 0.3, and except for F, where a -...
Write a program that reads a file named input.txt and writes a file that contains the same contents, but is named output.txt. The input file will contain more than one line when I test this. Do not use a path name when opening these files. This means the files should be located in the top level folder of the project. Do not use a copy method that is supplied by Java. Your program must read the file line by line...