请教一个关於C语言的编程

来源:百度知道 编辑:UC知道 时间:2024/05/29 15:23:33
想问一下如何利用ARRAY和POINTER把一段话中的指定数字替换成该数值指示的位置之上?例如:
Sample Input

Dear Sally,

Please, please do it--1 would 4
Mary very, 1 much. And 4 6
8 everything in 5's power to make
14 pay off for you.

-- Thank 2 18 18--
0

Sample Output

Dear Sally,

Please, please do it--it would please
Mary very, very much. And Mary would
do everything in Mary's power to make
it pay off for you.

-- Thank you very much--

比如说第一个数字是1,然后就把1替代成前一个单词it,4的话就往前推4个这样,而且不计算标点符号
急求,万分感谢
在此放上问题的原题:A simple scheme for creating a compressed version of a text file can be used for files which contain no digit characters. The compression scheme requires making a list of the words in the uncompressed file. When a non-alphabetic character is encountered in the uncompressed file, it is copied directly into the compressed file. When a word is encountered in the uncompressed file,

楼主,我想先问你一个问题?
你的每个数字是怎么算的?

比如Please, please do it--1 would 4
1是向左移了一个词it,
4是左移了would,还有前面一个it,再到do,再到please
这里是4个词还可以理解,
后面就开始不妥了。
Mary very, 1 much. And 4 6
4代表的Mary可以理解,越过了and,much,very,到了Mary,
可后面的6就不知道怎么回事罗
越过了and,much,very,Mary,到了would
可是这是5呀,因为从你前面的来看数字都不代表词,直接过了,

还有后面的8??
8 everything in 5's power to make
越过了do it would Mary very much And 总共是7呀,
后面后面,哎。。。你到底是怎么算的呀,自己好好改改先吧
难怪没有人回答你的问题

________________________
________________________
你再等等
给我点时间,我正在想:)

#include"stdio.h"
#include"string.h"
struct pointer
{
char *begin;
int length;
int is;
struct pointer *next;
struct pointer *pro;
};
int list(char *array,struct pointer* header)
{
int i=0;
int j=0;
int c=0;
int length=0;
struct pointer *newpoint;
struc