| | |
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 |
#include * adobe ansi api array asterisks binarysearch centimeter changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic execv feet fgets file fork frequency function getlasterror getlogicaldrivestrin givemetehcodez global grade graphics gtkgcurlcompiling gtkwinlinux hacking highest histogram include incrementoperators infiniteloop input interest kernel keyboard kilometer linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft mqqueue number odf opendocumentformat owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf segmentationfault sequential shape single socket socketprograming standard string systemcall threads turboc unix user voidmain() wab whythiscodecausesegmentationfault windows.h windowsapi





