Find Jobs
Hire Freelancers

concordance

$10-30 USD

Closed
Posted over 10 years ago

$10-30 USD

Paid on delivery
Description Using this code, without any other change, provide the missing code for function "printConcordance". It should: [login to view URL] your name followed by “CONCORDANCE” on one line [login to view URL] through keys in order [login to view URL] through words in order [login to view URL] you find the key, print the following on one line: 1.<= 3 preceding words (with spaces between) [login to view URL] “ >> “, key, “ << ” 3.<=3 following words (with spaces between) Code /* implement KWIC w/o data structures other than string & array - accept restrictions */ #include <iostream> #include <fstream> #include <stdlib.h> using namespace std; #define MAXWORDS 100 string myFile = "[login to view URL]"; string words [MAXWORDS]; // severe limitation!! int nWords=0; int readWords(const char* fileName, int maxWords, string words[]) { int nWords=0; ifstream inpt; [login to view URL] (fileName, std::ifstream::in); if (!inpt.is_open()) { cout << " ! failed to open " << myFile << endl; exit(1); } string word; while ( inpt>> word && nWords<maxWords) { words[nWords++] = word; cout << "input: " << word << endl; } [login to view URL](); return nWords; } bool findKey(const string target, const int nWrds, const string wrds[]) { //cout << "search for " << target << endl; for (int i=0; i<nWrds; i++) { //cout << " compare " << target << "to " << wrds[i] << endl; if ([login to view URL](wrds[i])==0) return true; } return false; } // inserts word in lexicographic order into wrds and returns number of words int insertSortedKey(string newWrd, const int nWrds, string wrds []) { //cout << "inserting: " << newWrd ; int insertionPoint =0; while (insertionPoint<nWrds ) { if ([login to view URL](wrds[insertionPoint])<0) break; insertionPoint++; } int j = nWrds; while (j>insertionPoint) { wrds[j]=wrds[j-1]; j--; } //cout << " at " << insertionPoint << endl; wrds[insertionPoint]= newWrd; return nWrds+1; } int getSortedKeys(const int nWrds, string wrds[], string keys[]) { int nKeys=0; for (int i = 0; i<nWords; i++) { if (!findKey(wrds[i],nKeys,keys)) { nKeys = insertSortedKey(wrds[i], nKeys, keys); } } return nKeys; } void printConcordance(const int nKeys, const string keys[], const int nWords, const string words[]) { / / deleted } int main () { // read words nWords = readWords(&myFile[0], MAXWORDS, words); // for (int i =0; i<nWords; i++) // cout << words[i] << endl; string keys[MAXWORDS]; int nKeys = getSortedKeys(nWords, words, keys); // for (int i =0; i<nKeys; i++) // cout << "key: " << keys[i] << endl; printConcordance(nKeys, keys, nWords, words); return 0; }
Project ID: 5345557

About the project

11 proposals
Remote project
Active 10 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
11 freelancers are bidding on average $23 USD for this job
User Avatar
Hi, I am C++ expert and can surely help you here with this project, Please let me know if you are interested. Thank You
$30 USD in 1 day
4.7 (196 reviews)
6.6
6.6
User Avatar
hi this is Asad, i have a lot of experience in c++ programming, this is very simple task for me,hire me wont disappoint you cheers :) p.s price in negotiable
$20 USD in 1 day
5.0 (38 reviews)
6.1
6.1
User Avatar
Hello Hiring Manager! i have done graduation in computer science. i have an experience of 4+ years in web designing and web development and have been doing job in software house since last 4 years. i am an expert in php, c++,jquer, ajax, htm, css and psd to html conversion. i am also master template designer and had recently designed 5 master templates each having 30 themes kindly visit my profile and see i have done 3 jobs in c++ and send them on time so that students dont get late. i will complete your job in few hours .so send me message and award me.i am ready to start it now. thanks
$30 USD in 0 day
4.8 (12 reviews)
3.9
3.9
User Avatar
Done a lot of works in C / C++ and optimizations, also working on mobile platforms which are critical to speed and resources
$25 USD in 3 days
5.0 (3 reviews)
3.7
3.7
User Avatar
hello , all i need is 24 hours as i am a bit bsy right now ............. thanx ... waiting for your reply .... regards.....................
$20 USD in 1 day
4.9 (8 reviews)
3.3
3.3
User Avatar
A proposal has not yet been provided
$24 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
i have worked on various langaues like c, c++ with windows api and opengl, java, xhtml/html, sql, php 4/5, java script, objective c, css/css3, action script etc............…
$17 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
A proposal has not yet been provided
$25 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
I have been programming in C++ for many years and have a BS degree in computer science. Also I am available to start on this project immediately.
$10 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Hello, cdixon222. I think, I can do your task in one day. Best regards, Vladimir Khadorik. my skype - khadorik.
$20 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
void printConcordance(const int nKeys, const string keys[], const int nWords, const string words[]) { printf("enter your name:"); char name[10]; scanf("%s",name); printf("%s CONCORDANCE",name); int no_keys; int no_words; int firstword; int secondword; int thirdword; int fourthword; int fifthword; int sixthword; for(no_keys=0;no_keys<nKeys; no_keys++) for(no_words=0;no_words<nWords;no_words++) { if(words[no_words]==keys[no_keys] && no_words>2) {firstword=no_words-3; secondword=no_words-2; thirdword=no_words-1; printf("%s %s %s",words[firstword],words[secondword],words[thirdword]);} printf(">> %s <<",keys[no_keys]); if(words[no_words]==keys[no_keys] && (no_words+3)<nWords) { fourthword=no_words+1; fifthword=no_words+2; sixthword=no_words+3; printf("%s %s %s\n",words[fourthword],words[fifthword],words[sixthword]); } } }
$37 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
Hallandale Beach, United States
5.0
16
Member since Jan 21, 2014

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.