26.03.2013, 18:50
Te publico el cуdigo bбsico aquн por sн ya no ingresas al otro foro (tambiйn se encuentra publicado allб).
Modificalo segъn lo necesites.
pawn Код:
#include <stdio.h>
#include <stdlib.h>
#define MAX_WORDS ( 25 )
#define MAX_LENGHT ( 30 )
int main(int argc, char *argv[])
{
int
count = 0,
j = -1;
char c,
words[2][MAX_WORDS][MAX_LENGHT] = {{'\0', '\0'}, {'\0', '\0'}};
do
{
c = getchar();
if(c == ' ' || c == '\t' || c == EOF) count++, j = -1;
else if(count == MAX_WORDS) {printf("La cantidad maxima de palabras son %d.",MAX_WORDS); break;}
else words[0][count][++j] = c, words[1][count][j] = '|';
}
while( c != '\n');
printf("\n");
for( int i = 0; i <= MAX_WORDS-1; i++)
{
if(words[0][i][0] != '\0') printf("[%2d]: %s\n", i+1, words[1][i]);
else continue;
}
printf("\n");
system("pause");
return EXIT_SUCCESS;
}