66 976
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #24476 in C++ for arem marcial

Question #24476
Write a program that asks the user to enter a word and display it in uppercase letters. (in upperLetter.txt)
Expert's answer
#include<iostream>
#include<string>
#include<fstream>
#include <stdio.h>
using namespace std;

int main()
{

cout<<"Please input some word : ";
string inputString;
getline(cin,inputString);

for(int i=0;i<inputString.length();i++)
{
if(isalpha(inputString.at(i)))
{
inputString.at(i) = toupper(inputString.at(i));
}
}

cout<<"\nYoure word in upper case : "<<inputString<<endl;
string fileName = "upperLetter.txt";
ofstream fout(fileName);
if(fout.is_open())
{
fout<<inputString;
fout.close();
cout<<"The word was written to the file : "<<fileName<<endl;
}
cin.clear();
cin.get();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions