Skip to main content


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 21:10 Go to next message
hossein khalaf is currently offline hossein khalafFriend
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 22:03 Go to previous messageGo to next message
Paul Bußmann is currently offline Paul BußmannFriend
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 22:33 Go to previous message
hossein khalaf is currently offline hossein khalafFriend
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: Fri Apr 26 09:59:56 GMT 2024

Powered by FUDForum. Page generated in 0.03470 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top