Write a program that will do the following:

1. Define a function that will read from a file text paragraph convert the whole paragraph into capital letters and print it on the screen after conversion.

2. Define a function that will count and return number of vowels in the above text.( a,e,i,o,u)

3. Write a main function that will call above functions to produce an output on sample text.

where is the code you have started to solve the problems? We will not write it for you. Write it a little bit at a time and your program will soon be written.

// really need help !!!!!!

#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;

string capital ();

string capital() 
{
ifstream obj1 ("C:\\file1.txt")
getline.obj1;
????
}

bool vowels (string);

bool vowels (string s) 
{ ???? }


int main ()
{



return 0; 
}

> Write a program that will do the following:
No, you read the forum rules first, then post some effort.

Comments
I completely agree. Well said!

There are lots and lots of examples here and other places on the net that show you how to read a file. I know there are also examples in your textbook, if you bothered to read and study it.

std::string line;
ifstream obj1 ("C:\\file1.txt")
while( getline( obj1, line) )
{
    // blabla
}
Comments
well said, as usual :)

could you please help me and tell me how can i convert the whole paragraph into capital letters using <iomanip> library function ?

You don't need iomanip to do that. The macro toupper() will make the conversion for you

char c = 'a';
char upperc = toupper(c);

Now you will have to put something like that in a loop so that the entire line is converted to upper case.

If you are really really smart and know your stuff you can do it like this:

#include <algorithm> 
#include <string>
using namespace std;
...
...
std::string line = "Hello World";
transform(line.begin(), line.end(), line.begin(), toupper);
This article has been dead for over six months. Start a new discussion instead.