Question: table.c #include //more header files and declarations as needed #define ROWs 40 #define COLs 50 int main(int argc, char *argv[]) { char table[ROWs][COLs] ..... ;

 table.c #include //more header files and declarations as needed #define ROWs

40 #define COLs 50 int main(int argc, char *argv[]) { char table[ROWs][COLs]

..... ; /* 2D array to store lines of input */ .....

printf("Enter rate~~word1 letter word2: "); fgets( , 50, ); // use fgets

table.c

#include  //more header files and declarations as needed #define ROWs 40 #define COLs 50 int main(int argc, char *argv[]) { char table[ROWs][COLs] ..... ; /* 2D array to store lines of input */ ..... printf("Enter rate~~word1 letter word2: "); fgets( , 50, ); // use fgets to read in whole line. You can move this line into while loop if you like. while (....) { ...... } /* output number of rows stored */ /* output the stored rows of the table */ ..... ..... return 0; }

inputB.c

2.0~~John x Josh 2.3~~Sunshine n Sunday 3.2~~LinhNguyen n LinhNguyenViet 6.6~~RonnieW n RonnieWX 6~~RonnieWyX i RonnieWy 12.33~~YuYing Y YuYang 20~~MikeJze e MikeJz 5.5~~Zigzag g Zig 5.72582~~Zigzag z Zigzig quit

Specification Write an ANSI-C program that reads user information from the standard inputs, and outputs both the original and the modified version of the records. . . Implementation A file table.c is provided for you to get started. As the existing code suggests, the program should use a table-like 2-D array (i.e., an array of "strings") to record the inputs. use fgets to read in the whole line as a "string", one line a time. keep on reading inputs (from standard in), one input per line, about the user information in the form of rate~~wordi letter word2, where rate is a floating point literal, word1 and word2 are strings composed of alphabetic letters but contains no spaces, and letter is a single character. See sample inputs below. Assume each input line contains less than 50 characters, and word1 and word2 each contains no more than 20 characters. store each (original) input string into the current available row of the 2D array, starting from row 0. create a modified string of the input, and store it in the next row of the 2D array. Then store "xxx" in the next next row. That is, the first (original) input is stored in row 0, the modified input is stored in row 1. "xxx is stored in row 2. The second (original) input is stored in row 3, and its modified input is stored in row 4, "xxx" is stored in row 5, and so on. Assume that the total number of inputs is no more than 1/3 the number of rows of the table. In the modified version of input, word1 is modified such that each letter in it is replaced with the 'next' alphabetic letter in ascii character set. E.g., 'a'is changed to 'b', 'K' is replaced with 'L'. As a special case, 'z' is replaced with 'a', and 'z' is replaced with . O 'A'. O Next in the modified input is a new word with every occurrence of character letter in the original wordt being replaced by *. O O Next in the modified input is the new rate which has a 60% increase and is formatted with 4 digits after decimal point. These values are followed by the floor and ceiling of the increased rate. Following the above values is character of > or otherwise. Assume that wordt and word2 never has the same contents. [bouns] The modified input is ended with the character in word2 which has the largest encoding in the ASCII character set table. That is, the character which, among all the characters in name2, appears the latest in the ASCII table. These values are separated by [] and as shown in the sample outputs. O O C continue reading input, until quit is entered. after reading all the inputs, the program outputs the total number of rows stored, and then the stored rows of the 2-D array row by row, displaying each original input followed by the modified version of the input and "xxx line. . . Note Your work deserves partial marks, for each component implemented. If you have difficulty solving the problem by reading in a whole line using fgets, you can try to read in each line of input into multiple variables (as you did in lab4table). You will lose some marks though. It is okay to store the 'quit into the table, as long as it is not counted and not printed. You will lose almost all marks if, instead of a 2D-array, you use several parall 1-D arrays -- one for all word1s, one for all rates etc -- to store and display information. . Sample Inputs/Outputs: red 307 % a.out Enter rate~~word1 letter word2: 1.0~~Josh s John Enter rate~~wordi letter word2: 2.3--Sony u Sue Enter rate~~wordi letter word2: 1.2~~HELLO L HiThere Enter rate~~wordi letter word2: 3.22~~JusyZu u Jusy Zuwy Enter rate~~wordi letter word2: quit bonus Totally 12 rows are stored [0]: 1.0~~Josh s John [1]: Kpti--Jo*h--[1.6000...1...2] > 'o' [2]: xxx [3] : 2.3~~ Sony u Sue [4] : Tpoz--Sony--[3.6800...3...4] 'y' [5]: xxx [6]: 3.2LinhNguyen n LinhNguyenViet [7]: MjoiOhvzfo--Li*hNguye*--[5.1200...5...6] 'y' [14]: xxx [15]: 12.33~~YuYing Y YuYang [16]: ZvZjoh--*u*ing--[19.7280...19...20] > 'u' [17]: xxx [18]: 20~~MikeJze e MikeJz [19]: NjlfKaf--Mik*Jz*--[32.0000...32...32] > 'z' [20]: xxx [21]: 5.5~~Zigzag g Zig [22]: Ajhabh--Zi*za*--[8.8000...8...9] > 'i' [23]: xxx [24]: 5.72582~~Zigzag z Zigzig [25] : Ajhabh--Zig*ag--[9.1613...9...10] or otherwise. Assume that wordt and word2 never has the same contents. [bouns] The modified input is ended with the character in word2 which has the largest encoding in the ASCII character set table. That is, the character which, among all the characters in name2, appears the latest in the ASCII table. These values are separated by [] and as shown in the sample outputs. O O C continue reading input, until quit is entered. after reading all the inputs, the program outputs the total number of rows stored, and then the stored rows of the 2-D array row by row, displaying each original input followed by the modified version of the input and "xxx line. . . Note Your work deserves partial marks, for each component implemented. If you have difficulty solving the problem by reading in a whole line using fgets, you can try to read in each line of input into multiple variables (as you did in lab4table). You will lose some marks though. It is okay to store the 'quit into the table, as long as it is not counted and not printed. You will lose almost all marks if, instead of a 2D-array, you use several parall 1-D arrays -- one for all word1s, one for all rates etc -- to store and display information. . Sample Inputs/Outputs: red 307 % a.out Enter rate~~word1 letter word2: 1.0~~Josh s John Enter rate~~wordi letter word2: 2.3--Sony u Sue Enter rate~~wordi letter word2: 1.2~~HELLO L HiThere Enter rate~~wordi letter word2: 3.22~~JusyZu u Jusy Zuwy Enter rate~~wordi letter word2: quit bonus Totally 12 rows are stored [0]: 1.0~~Josh s John [1]: Kpti--Jo*h--[1.6000...1...2] > 'o' [2]: xxx [3] : 2.3~~ Sony u Sue [4] : Tpoz--Sony--[3.6800...3...4] 'y' [5]: xxx [6]: 3.2LinhNguyen n LinhNguyenViet [7]: MjoiOhvzfo--Li*hNguye*--[5.1200...5...6] 'y' [14]: xxx [15]: 12.33~~YuYing Y YuYang [16]: ZvZjoh--*u*ing--[19.7280...19...20] > 'u' [17]: xxx [18]: 20~~MikeJze e MikeJz [19]: NjlfKaf--Mik*Jz*--[32.0000...32...32] > 'z' [20]: xxx [21]: 5.5~~Zigzag g Zig [22]: Ajhabh--Zi*za*--[8.8000...8...9] > 'i' [23]: xxx [24]: 5.72582~~Zigzag z Zigzig [25] : Ajhabh--Zig*ag--[9.1613...9...10]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!