C program Files

Apr 11th, 2014
Anonymous
Category:
Engineering
Price: $15 USD

Question description

Develop the function char** indexedKeysAndOPerators(const char * 

fName)  with the following specifications :

fName parameter represents the path name of a file + source code C + +. 

The return value represents an array of null terminated strings.

 For each  katholiko block of source code fName there is an element in the table return . 

The element is formed from the keywords and the operators of the respective blocks as follows : 

Each keyword (keyword) and / or operator (operator) encountered in block numbered and inserted numbered into string.  

Different keywords and / or operators have a different numbering . Also , the numbers are different for each block . 

The string produced for each ledger(katholiko) block of insertion code will name it representation of keys .

ledger,katholiko = called a code block that is not contained within another block

For EXAMPLE:

#include <iostream> 

#include <fstream> 

using namespace std ; 

void displayFile (const char * fName ) { 

//yellow area start

ifstream in; 

in.open (fName ); 

if (!in.is_open ()) { 

cout << fName << " not opened" << endl ; 

return; 

char buffer [1024 ]; 

while (!in.eof ()) { 

in.getline (buffer , sizeof (buffer )); 

cout << buffer << '\n' ; 

in.close (); 

//yellow area finish

int main (){ 

//green area start

displayFile ("main.cpp" ); 

return 0; 

//green area finish

}

The code above has 2 ledger blocks: the body of  displayFile (yellow area) and the body of main (green area). 

Therefore, the key representation for the yellow and green blocks are respectively as follows:

The yellow area have keywords as follows: 1 char, 2 cout, 1 endl, 1 

if, 1 while and operands: 1 [, 3 (), 5., 2!, 1 return and 5 (. 

� Similarly, in the green region have keywords as follows: 1 return and 

operators: 1. 1 (. 

Accordingly, indexedKeysAndOPerators will return an array of size 2 to 

contains the following strings

char1, cout1, cout2, endl1, if1, return1, while 1, [1, ()1, ()2, ()3, !1, !2, (1, (2, (3, (4, (5, .1,

.2, .3, .4, .5

return1, (1, .1

Add a main that takes as a parameter the name of a source code C + + and

will print on the screen the result of indexedKeysAndOPerators.

A list of keywords and operators given in file keywords.txt. The order of

keywords and operators can be changed in keywords.txt if deemed that

facilitate the implementation of indexedKeysAndOPerators.

keywords.txt 

Tutor Answer

(Top Tutor) dabhand
School: Carnegie Mellon University

Studypool has helped 1,244,100 students

Review from student
Anonymous
" Excellent job "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1824 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors