i got my act together and wrote the pig latin program, i just think i was overwhelmed when I first saw the description. Well the issue now is that I dont care about how it looks, but the output is not what the assignment requires, what am I doing wrong
I am attaching a text file with the desired output. thanks alot and once again sorry!!!!
Code:#include <string.h> #include <stdio.h> #include <ctype.h> #include <stdlib.h> char ch; /**/ int v, x, y, z; /**/ char temp[25]; /**/ /**/ /**/ void end ( void ); /**/ void PigLatin(char *str); /**/ void clear_temp ( void ); /**/ /**/ int main(void) { /**/ /**/ /**/ /**/ /**/ /**/ /**/ /**/ do { char phrase[1000]; /**/ printf( "Enter your dialog to be converted."); /**/ printf( "\n" ); /**/ fflush ( stdin ); /**/ gets( phrase ); /**/ /**/ y = 0; /**/ x = strlen ( phrase ); /**/ z = 0; /**/ /**/ /**/ printf("Your phrase is: %s", phrase ); /**/ printf("\n\n"); /**/ /**/ printf("In Pig Latin that's: "); /**/ do { /**/ if ( isspace (phrase[y]) == 0 ){ /**/ temp[z] = phrase[y]; /**/ z = z + 1; /**/ } /**/ else PigLatin ( temp ); /**/ y = y + 1; /**/ /**/ } while ( y <= x ); /**/ PigLatin ( temp ); /**/ /**/ if ( phrase[x-1] == '!' || phrase[x-1] == '.' || phrase [x-1] == '?' ) { printf ("\b%c", phrase [x-1] ); } printf ( "\n\n\n" ); printf( "Would you like to do another one?"); /**/ printf ("\n" ); do { /**/ printf( "Enter ""y"" or "" n""."); /**/ printf ( "\n" ); /**/ fflush ( stdin ); /**/ scanf( "%c", &ch ); /**/ ch = tolower ( ch ); /**/ /**/ } while ( ch != 'n' && ch != 'y'); /**/ } while (ch != 'n'); /**/ end ( ); /**/ return 0; } void PigLatin(char *str) /**/ { char head = str[0]; /**/ char temp = tolower ( head ); /**/ /**/ if ( temp == 'a' || temp == 'e' || temp == 'i' || temp == 'o' || temp == 'u' ){ /**/ while(*str) /**/ if ( ispunct ( *str ) == 0 ) putchar(*str++); /**/ else str++; printf("yay "); /**/ } else { str++; /**/ while(*str) /**/ if ( ispunct ( *str ) == 0 ) putchar(*str++); /**/ else str++; printf("%cay ", head); /**/ } z = 0; /**/ clear_temp (); /**/ return; } void clear_temp ( void ) { int w; for ( w = 0; w <= 24; w++) /**/ temp[w]=0; /**/ return; } void end ( void ) { printf( "aterLay udeday!!!\n "); exit (0); }



LinkBack URL
About LinkBacks


