Simple Command interface in Ansi C

Hi

I have written this here small C program:

#include

int main(){

int number;

printf("Do You want to exit?
Press '0' for yes or '1' for no!");
scanf("%d",&number);
if(number == 0){
printf("exiting-bye");
}
else if(number == 1){
printf("You have choosen to continue");
}
return 0;
}

How do I change the code above so it only show one prinf-line at a time?

You know MS DOS style !

Cheers

Fred

Comments

  • : Hi
    :
    : I have written this here small C program:
    :
    : #include
    :
    : int main(){
    :
    : int number;
    :
    : printf("Do You want to exit?
    Press '0' for yes or '1' for no!");
    : scanf("%d",&number);
    : if(number == 0){
    : printf("exiting-bye");
    : }
    : else if(number == 1){
    : printf("You have choosen to continue");
    : }
    : return 0;
    : }
    :
    : How do I change the code above so it only show one prinf-line at a
    : time?
    :
    : You know MS DOS style !
    :
    : Cheers
    :
    : Fred

    add "
    " to the end of each printf() statement.

    =============================================
    never lie -- the government doesn't like the competition. (Author unknown)
  • Hello Stober,

    I am sorry, but I formulated myself wrongly.

    What I meant was how do I add some code to my program such that a previous prinf is deleted from the users view, then another comes into service?

    Cheers
    Fred
  • : Hello Stober,
    :
    : I am sorry, but I formulated myself wrongly.
    :
    : What I meant was how do I add some code to my program such that a
    : previous prinf is deleted from the users view, then another comes
    : into service?
    :
    : Cheers
    : Fred
    :

    add "
    " to the beginning of each printf() statement to move the cursor back to the beginning of the current line.
    =============================================
    never lie -- the government doesn't like the competition. (Author unknown)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories