oke i am sorry for before i didnt know about this side so much. Now i am sending a file with attachemnt. I have to rewrite this while loop. if you help me i will presuade about your helps.

Recommended Answers

All 3 Replies

uhm.. could you just post your code? properly? ^__^

How did you manage to create a 500K ZIP file?

Just post the code, in code-tags. We don't need all the other project crap which is of no use to anyone else who doesn't have your specific tools.

oke i am sorry for before i didnt know about this side so much. Now i am sending a file with attachemnt. I have to rewrite this while loop. if you help me i will presuade about your helps.

*Whew* We were so concern that you would take such a drastic measure against yourself. Glad that you decided to stick around.

Pay attention.
I am going to show you something. Look at the code that you posted in the other thread.

har letter ;

printf("enter the antibiotic sample >>>>> ");

scanf("%c", &letter);

switch (letter)
{
case 'N':
case 'n':

printf("Perform standard tests 2, 3, and 4.Record results in notebook #3.\n");
break;

case 'P':
case 'p':

printf("Perform standard tests 1, 5.Record results in notebook #2\n");
break;

case 'B':
case 'b':

printf("Perform standard tests 1, 5.Record results in notebook #2 and \n Perform standard tests 2, 3, and 4.Record results in notebook #3. \n");
break;

case 'Z':
case 'z':

printf("Throw away sample\n");
break;

default:
printf("unknown class %c\n", letter);
printf("\n\n\n");
}
return 0;
}

and now i am sending my while program which supposed to be same function with another one

char letter;
while(scanf("%c", &letter) == 'N' || 'n' )
{
printf("Perform standard tests 2, 3, and 4.Record results in notebook #3.\n");
}
printf("enter the antibiotic sample >>>>> ");

while(scanf("%c", &letter) == 'P' || 'p')
{
printf("Perform standard tests 1, 5.Record results in notebook #2\n");
}
printf("enter the antibiotic sample >>>>> ");
while(scanf("%c", &letter) == 'B' || 'b')
{
printf("Perform standard tests 1, 5.Record results in notebook #2 and \n Perform standard tests 2, 3, and 4.Record results in notebook #3. \n");
}
while(scanf("%c", &letter) == 'Z' || 'z')
{
printf("Throw away sample\n");
}

Ugly, isn't it? Now select all the code and highlight it. Click in the `#' icon in the top of the editor window. Third from the right. Yeah, that's the one. Now, edit the first

and add a `=C' after the E, just like this: [CODE[B]=C[/B]].

[B]VoilĂ ![/B] Look what happened to your code:
[code=C]
/*
 * dumb.c
 * Shows how not to program
 * Using a while loop.
 */                                   
#include <stdio.h>

#define FALSE 0
#define TRUE !FALSE

int main(void)
{
    int letter  = '\0';
    int done = FALSE;
    
    puts( "\tWelcome to the personality game" );
    puts( "What kind of person are your?: " );
    
    while ( !done ) /* loop as long we are not done */
    {
        puts( "G - Generous" );
        puts( "M - Moron" );
        puts( "R - Romantic" );
        puts( "T - Greatful" );

        printf( "Enter choice: " );
        fflush( stdout );
    
        /*
         * start of the section for obtaining a character from user
         */
        letter = getchar();  /*  Click the link at bottom to know why I didn't use scanf() */
        if (  letter != '\n' && letter != EOF )
        {
            while ( ( done = getchar() ) != '\n' && done != EOF )
            {
                ;    /* do nothing */
            }
        }
        else
        {
            puts( "Enter M next time\n\n" );
            continue;       
        }
        /* end of section for obtaining a character from user */
    
        switch ( letter ) 
        {
            case 'G':
            case 'g':
                puts( "Yeah right!. Where's the money for doing your code?" );
                done = TRUE;
                break;

            case 'M':
            case 'm':
                puts( "Even morons can learn how to be generous" );
                done = TRUE;
                break;
                
            case 'R':
            case 'r':
                  puts( "Stop loving me and be more generous" );
                done = TRUE;
                break;
            
            case 'T':
            case 't':
                  puts( "I don't live out of thanks alone" );
                done = TRUE;
                break;

            default:
                puts( "Choose moron next time, would you?\n");
                done = FALSE;                              
                break;
        } /* end of switch */
    } /* end of while loop */

    return 0;
}

Do you see how nice it looks now?. The reason why we have been telling you about proper tagging is because that icon (`#') is an exclusive secret feature, that allows you to somehow connect to a version of yourself in another dimension. This alternative reality of yourself knows exactly what you mean ( meant ) when you post. Pressing the bottom fix your problems by giving you a glimpse of the posibilities. Now you know.
Important link: Click here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.