Please Help Write a C program Find all words in the file 7lt

Please Help!!!

Write a C++ program:-

Find all words in the file 7ltr-words.txt that start with \"qu\" or \"ch\" and have the same trailing 5 letters. Display each pair found, the total of \'qu\' and \'ch\' words, and the number of matches. For example:

found charter and quarter
found chipped and quipped
...
found 614 seven letter words starting with \"qu\" or \"ch\"
found 23 matches

I couldn\'t able to upload the text file, so I pasted it :-7ltr-words.txt as below --Thank you so much---

aarrghh
abactor
abalone
abanded
abandon
abasers
abashed
abashes
abasias
abasing
abaters
abating
abators
abattis
abature
abaxial
abaxile
abbotcy
abdomen
abduced
abduces
abducts
abelian
abelias
abettal
abetted
abetter
abettor
abeyant
abfarad
abhenry
abidden
abiders
abiding
abigail
ability
abioses
abiosis
beanies
beaning
bearcat
bearded
beardie
bearers
bearhug
bearing
bearish
beastie
beastly
beatbox
beaters
beathed
beatify
beating
beatnik
beaufet
beaufin
beauish
beavers
beavery
bebeeru
beblood
bebungs
becalls
becalms
becasse
because
bechalk
becharm
beckets
becking
beckons
beclasp
becloak
beclogs
becloud
beclown
becomes
becrawl
becrime
becrowd
becrust
becurls
bedmate
bedouin
bedpans
bedpost
bedrail
bedrals
bedrape
bedrock
bedroll
bedroom
beduins
bedumbs
bedunce

yenning
yuckers
yuckier
yucking
yukatas
yukiest
yukkier
yukking
yummier
yummies
yumpies
yumping
yuppies
yuppify
zabetas
zabtieh
zacaton
zaddick
zaddiks
zaffars
zaffers
zaffirs
zaffres
zagging
zaikais
zakuska
zakuski
zamangs
zamarra
zamarro
zambuck
zambuks
zamouse
zampone
zamponi
zananas
zanders
zandoli
zanella
zilches
zillahs
zillion
zimmers
zimocca
zincate
zincier
zincify
zincing
zincite
zincked
zincode
zincoid
zincous
zingani
zingano
zingara
zingare
zingari
zingaro
zingels
zingers
zingier
zinging
zinkier
zinkify
zinking
zinnias
zipless
ziplock
zippers
zippier
zipping
zircons
zithern
zithers
zizania
zizzing
zizzled
zizzles
zloties
zlotych
zoarial
zoarium
zocalos
zoccolo
zodiacs
zoecium
zoeform
zoisite
zombies
zombify
zonally
zonated
zonings
zonking
zonulae
zonular
zonulas

Solution

//We ar assuming that there is no duplicacy of words.
// I have used zo and zi to match the string . you can change the word according to the input file in line number 46 and 51.


#include\"iostream\"
using namespace std;
#include<string.h>
#include\"fstream\"
#include<stdlib.h>
#include<assert.h>
char reading[1000][8];
char sub_reading[1000][6];
void substr(int i, int j, int c)
{     
        int k=2;
        while(k<=6)
        {
                sub_reading[c][k-2]=reading[c][k];                            
                k++;
        }
}
int match_substring(int i,int j)
{
        int r;
        r=strcmp(sub_reading[i],sub_reading[j]);
        r=r+1;
        return r;
}
int main()
{
        int count, match,matchs[1000]={0},i,j,flag=0;
        ifstream instream;
        instream.open(\"7ltr-words.txt\", ios::in);
        count =0;
        while(instream.read(reading[count],sizeof(reading[count])))
        {
                reading[count][7]=\'\\0\';
                count++;
        }
        for(i=0;i<count;i++)
        {
                substr(2,6,i);
        }
        for(i=0;i<=count;i++)
        {
                if(matchs[i]==0)
                if(reading[i][0]==\'z\' && reading[i][1]==\'o\')
                {                     
                        for(j=0;j<=count;j++)
                        {
                                if(matchs[j]==0)
                                if(reading[j][0]==\'z\' && reading[j][1]==\'i\')
                                {
                                        flag = match_substring(i,j);
                                        if(flag==1)
                                        {
                                                cout<<\"Found \"<<reading[i]<<\" and \"<<reading[j]<<\"\ \";
                                                matchs[i]=1;
                                                matchs[j]=1;
                                                flag=0;
                                                break;
                                        }
                                }
                        }
                }
        }
}

Please Help!!! Write a C++ program:- Find all words in the file 7ltr-words.txt that start with \
Please Help!!! Write a C++ program:- Find all words in the file 7ltr-words.txt that start with \
Please Help!!! Write a C++ program:- Find all words in the file 7ltr-words.txt that start with \
Please Help!!! Write a C++ program:- Find all words in the file 7ltr-words.txt that start with \
Please Help!!! Write a C++ program:- Find all words in the file 7ltr-words.txt that start with \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site