Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » do-while not work(do-while did not work in c\c++ ide eclipse?)  () 1 Vote
do-while not work [message #987495] Mon, 26 November 2012 16:10 Go to next message
hossein khalaf is currently offline hossein khalaf
Messages: 2
Registered: November 2012
Junior Member
#include <stdio.h>
#include <stdlib.h>

int main(void) {
int a=100;
do{
printf("insert a");
scanf("%d",&a);
}while(a<10);
return (0);
}
I write this code in eclipse C\C++ IDE but did not work.
and console tab in ide did not show any thing and when i stop the program it show "insert a"
Re: do-while not work [message #987502 is a reply to message #987495] Mon, 26 November 2012 17:03 Go to previous messageGo to next message
Paul Bußmann is currently offline Paul Bußmann
Messages: 17
Registered: October 2012
Junior Member
You are missing a flush.

This works:

...
printf("insert a");
fflush(stdout);
scanf("%d",&a);
...

See also "[SOLVED] No Output in Console" http://www.eclipse.org/forums/index.php/t/156519/ .
Re: do-while not work [message #987509 is a reply to message #987502] Mon, 26 November 2012 17:33 Go to previous message
hossein khalaf is currently offline hossein khalaf
Messages: 2
Registered: November 2012
Junior Member
thank you so much you solve my problem i use "fflush(stdout)" and work goog
Previous Topic:empty project cannot build and cannot find binary.
Next Topic:include *.pch
Goto Forum:
  


Current Time: Wed Jul 23 05:58:00 EDT 2014

Powered by FUDForum. Page generated in 0.02392 seconds