60 377
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #53766 in C++ for ysrao

Question #53766
Write a C++ program as per the following instructions:
(i) Write a C++ code which reads the contents of a text file “first_file.txt”
(ii) Write a function named vowel_words() which will segregate the words starting with vowels
from the “first_file.txt”
(iii) Write a C++ code which writes the resultant words to the output file, “second_file.txt”.
Example: Content of first_file – “I am going to buy an umbrella”
Output in second_file.txt – I am an umbrella
Expert's answer
#include <iostream>

using namespace std;

void Sort(int* arr, int size);

int main() {

int array[10];

cout<<"Enter 10 integer values : \n";

for (int i = 0 ; i < 10; i++)
cin>>array[i];

cout<<"\nInitial array : ";

for (int i = 0 ; i < 10; i++)
cout<<array[i]<<" ";

cout<<endl;

Sort(array, 10);

cout<<"\nArray on ascending order : ";
for (int i = 0 ; i < 10; i++)
cout<<array[i]<<" ";

cout<<endl;

cin.clear();
cin.ignore(1000, '\n');
cin.get();

return 0;
}


void Sort(int* arr, int size)
{
int tmp;

for(int i = 0; i < size - 1; ++i) // i - number of passes
{
for(int j = 0; j < size - 1; ++j) // inner loop of passage
{
if (arr[j + 1] < arr[j])
{
tmp = arr[j + 1];
arr[j + 1] = arr[j];
arr[j] = tmp;
}
}
}
}

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