![]() |
|
#1
|
|||
|
|||
A program to convert miles to kilometresIm a noob trying to learn C by making simple programs as i go and need help, i cant get a program to convert miles to kms that i made to work because it asks for a number of miles to convert, but then i dont know how to get it to actually convert and another one real simple, just opens a box and prints out Hello, but for some reason that box lasts less then a second, how can i get these to work out? (the mile-km converter closes wen i press enter)
|
|
#2
|
||||
|
||||
Re: newbie needing help for CHi Persian,
Welcome to the GIDForums. Which compiler do you use? Do you use an IDE? If so, you must pause the program for a while, so that you can see the output. Please take a look here: Pausing a program Please read the Guidelines too. Regards, Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#3
|
|||
|
|||
Re: newbie needing help for CI just looked thru the link u gave, and i tried the 3 different options it gives u, finding getchar();the best but now the window opens and no words come up?
this is the code CPP / C++ / C Code:
Last edited by LuciWiz : 30-Jan-2006 at 09:01.
Reason: Please insert your C code between [c] & [/c] tags
|
|
#4
|
|||
|
|||
Re: newbie needing help for C"P wait the guidlines say to do this so
CPP / C++ / C Code:
Last edited by LuciWiz : 30-Jan-2006 at 09:03.
Reason: You need to use an end tag too ([/c])
|
|
#5
|
||||
|
||||
Re: newbie needing help for CPut the getchar before return 0;
CPP / C++ / C Code:
Always put your pause functions before return 0; Insert your code between [c] and [/c] tags. Regards, Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#6
|
|||
|
|||
Re: newbie needing help for Cthx, it works now
btw with these commands, is there a method of know wat order commands like that go in, like where to put them? |
|
#7
|
||||
|
||||
Re: newbie needing help for CQuote:
If you want to pause the program before the end of the program, put it before return 0; For example, consider this code: CPP / C++ / C Code:
Regards, Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#8
|
|||
|
|||
Re: newbie needing help for Ckk, thx alot
|
|
#9
|
|||
|
|||
Re: newbie needing help for CU woodnt happen to know what to do about a kilometre-mile converter that asks for a number in miles but closes wen u give it a number and press enter, i dont get how it to work so that it actualy converts
|
|
#10
|
||||
|
||||
Re: newbie needing help for CYou would've done an illegal operation.
For example, if you give a character as input when you need integer, the program would quit. If you divide a number by 0, the program would quit. Please post your code, so that we'll be able to find out what is the error. There is also another source for error. The scanf function! If you use scanf, it will lead to a lot of errors. It will put the extra characters in the stdin buffer, and one getchar wont work. You can look at the C/C++ tutorial subforum to find a lot of tutorial on scanf. When you use scanf, put getchar after that scanf, and this will work. There are also other methods. For example, like this: CPP / C++ / C Code:
Regards, Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
Recent GIDBlog
Welcome to Baghdad by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C program to convert NFA to DFA | ayoub | C Programming Language | 11 | 14-Sep-2007 14:51 |
| creating a file in [c] | i hate c | C Programming Language | 15 | 21-Nov-2005 12:52 |
| Is my program coded well? | dave88 | C Programming Language | 6 | 14-Oct-2005 09:18 |
| Type casts ? | kai85 | C++ Forum | 12 | 23-Jun-2005 12:04 |
| fltk-2.0 cvs | Plumb | FLTK Forum | 20 | 13-Nov-2004 07:10 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The