| | |
strange problem
![]() |
•
•
Join Date: Nov 2004
Posts: 108
Reputation:
Solved Threads: 3
Well it's not a strange problem considering it's doing what it is supposed to do.
First off, when posting code please use code tags. Read here
Second, main returns an int it should be int main(void).
Third, When writing please use complete sentences and use "you" not "u". Also using a bunch of question marks doesn't make your question more of a question.
Fourth, what your program is doing is looping while (1). This is saying while true repeat(any non zero number is "true"). What you were probably going for was something like this:
First off, when posting code please use code tags. Read here
Second, main returns an int it should be int main(void).
Third, When writing please use complete sentences and use "you" not "u". Also using a bunch of question marks doesn't make your question more of a question.
Fourth, what your program is doing is looping while (1). This is saying while true repeat(any non zero number is "true"). What you were probably going for was something like this:
C Syntax (Toggle Plain Text)
#include <stdio.h> int main(void) { int number; do { /*notice the spacing it makes your code much easier to read*/ printf("*\n"); printf("Enter 0 if you want to quit\n"); scanf("%d",&number); }while (number != 0); return 0; }
Join me on IRC:
Server: irc.daniweb.com
Channel: #C++
Chat Via:
http://daniweb.com/chat/minichat.php
or
Your favorite IRC client.
Server: irc.daniweb.com
Channel: #C++
Chat Via:
http://daniweb.com/chat/minichat.php
or
Your favorite IRC client.
![]() |
Similar Threads
- Strange problem (Windows tips 'n' tweaks)
- Strange problem (Troubleshooting Dead Machines)
- Is this Strange problem due to virus ? (JavaScript / DHTML / AJAX)
- Strange problem with vs 2005 when starting application (ASP.NET)
- strange problem - cookies on desktop (Windows NT / 2000 / XP)
- Rather strange problem copying, need assistance. (Perl)
- Help. This is a strange problem (C++)
- HELP!!! very strange problem! (Troubleshooting Dead Machines)
Other Threads in the C Forum
- Previous Thread: Can someone help at least get started its due monday please
- Next Thread: Another question regarding memory
| Thread Tools | Search this Thread |
* adobe ansi api array binarysearch centimeter changingto char character cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax database directory feet fflush fgets file floatingpointvalidation fork frequency function givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux highest histogram homework i/o inches infiniteloop input interest intmain() iso keyboard kilometer km linked linkedlist linux linuxsegmentationfault list locate looping lowest match meter microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation owf pattern pdf performance posix power probleminc program programming pyramidusingturboccodes read recv recvblocked repetition reversing scanf scheduling segmentationfault send single socketprograming socketprogramming stack standard string suggestions systemcall unix urboc user voidmain() wab whythiscodecausesegmentationfault win32api windows.h windowsapi





