Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a text file in C++. Write at least 20 words in 4 to 5 sentences into the

ID: 3544620 • Letter: C

Question

Create a text file in C++. Write at least 20 words in 4 to 5 sentences  into the file. Then Capitalise the first letter of every word and store it in a new file. Then print both the original and the modified file. Make a menu driven program.
Please do not use string to upper the letter use normal logic
thanks Create a text file in C++. Write at least 20 words in 4 to 5 sentences  into the file. Then Capitalise the first letter of every word and store it in a new file. Then print both the original and the modified file. Make a menu driven program.
Please do not use string to upper the letter use normal logic
thanks

Explanation / Answer

#include<fstream.h>

#include<conio.h>

#include<stdio.h>

#include<process.h>

char str[80],word[20];

void main()

{

ifstream fin;

ofstream fout;

clrscr();

int ch;

while(1)

{ clrscr();

cout<<" MENU"

<<" 1.Create a text file"

<<" 2.Modify the file (Capitalise the first letter of every word)"

<<" 3.Display the files"

<<" 4.Exit";

cin>>ch;

switch(ch)

{

case 1:

int lines;

cout<<" Number of lines";

cin>>lines;

fout.open("Text.txt");

for(int i=1;i<=lines;i++)

{

gets(str);

fflush(stdin);

fout<<str;

fout<<" ";

}

fout.close();

break;

case 2:

fin.open("Text.txt");

fout.open("New.txt");

while(fin>>word)

{

if(word[0]>='a'||word[0]<='z')

{

word[0]-32;

}

fout<<str<<" ";

}

fin.close();

fout.close();

break;

case 3:

cout<<" original file";

fin.open("Text.txt");

while(fin.getline(str,80,' '))

{

puts(str);

}

fin.close();

cout<<" New file";

fin.open("New.txt");

while(fin.getline(str,80,' '))

{

puts(str);

}

fin.close();

getch();

break;

case 4:exit(0);

}

}


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote