#include<iostream> #include <fstream> #include<string> //Needed for toupper func
ID: 3619105 • Letter: #
Question
#include<iostream>
#include <fstream>
#include<string>
//Needed for toupper function
#include<cctype>
using namespace std;
void Capitalize (char *sentencePrt);
int main()
{
//Declares maximum size of file name
const int SIZE = 51;
//Array to hold the file name
char fileName[SIZE];
//Holds the string
char data[256];
//Input file
ifstream inFile;
//File is opened
ofstream outFile("out.txt");
outFile.write(data,sizeof(data));
}
//Function to capitalize each sentence
void Capitalize(char *sentencePrt)
{
int i = 0,j;
if(sentencePrt[i]> 97 && sentencePrt[i] < 112)
{
sentencePrt[i] -= 32;
}
for (i=0;i<strlen(sentencePrt); i++)
{
j = i;
if(sentencePrt[i]=='.')
j++;
if(sentencePrt[j] =='')
{
j++;
}
if((sentencePrt[j]> 97 && sentencePrt[j] < 112))
{
sentencePrt[j] -= 32;
}
}
}
Explanation / Answer
please rate - thanks hope you don't mind, I made a few changes. let me know if youdon't want to use the string functions, can write our own #include #include #include //Needed for toupper function #include using namespace std; void Capitalize (char[] ,int& ); int main() { //Declares maximum size of file name int begin=1; const int SIZE = 51; //Array to hold the file name char fileName[SIZE]; //Holds the string char data[256]; //Input file ifstream inFile; //File is opened ofstream outFile("out.txt"); //Asks the user to enter the name of the input file file cout > fileName; //Gets a character from the file inFile.open(fileName); //Checks to see if the file opened if (!inFile) { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.