// 10142009.cpp, P H Anderson, Oct 14, '09 #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { float x; float y; } CPLX; void capitalize_letter(char *s, int nth); char up_case(char ch); void replace_letter(char *s, char c1, char c2); void reverse_str(char *s); void swap_char(char *p1, char *p2); void encrypt_str(char *s, int cipher); void decrypt_str(char *s, int cipher); CPLX fetch_complex(void); int main() { char s[50]; CPLX z1; strcpy(s, "what's the story?"); capitalize_letter(s, 4); printf("PT #1 %s\n", s); replace_letter(s, 'a', 'b'); printf("PT #2 %s\n", s); reverse_str(s); printf("PT #3%s\n", s); encrypt_str(s, 5); printf("PT #4 %s\n", s); decrypt_str(s, 5); printf("PT #5%s\n", s); z1 = fetch_complex(); printf("%.2f %.2f\n", z1.x, z1.y); system("pause"); } void capitalize_letter(char *s, int nth) { // stub s[3] = up_case(s[3]); } char up_case(char ch) { // stub return('A'); } void replace_letter(char *s, char c1, char c2) { // stub s[0] = 'X'; } void reverse_str(char *s) { // stub int len; len = strlen(s); swap_char(&s[0], &s[len - 1]); } void swap_char(char *p1, char *p2) { char tmp; tmp = *p1; *p1 = *p2; *p1 = tmp; } void encrypt_str(char *s, int cipher) { // stub s[0] = s[0] + 5; } void decrypt_str(char *s, int cipher) { // stub s[0] = s[0] - 5; } CPLX fetch_complex(void) { CPLX q; float a, b; printf("Enter real and imag: "); scanf("%f %f", &q.x, &q.y); return(q); } #ifdef OUTPUT PT #1 whaA's the story? PT #2 XhaA's the story? PT #3XhaA's the story? PT #4 ]haA's the story? PT #5XhaA's the story? Enter real and imag: 3 4 3.00 4.00 Press any key to continue . . . #endif