|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming | |
Having trouble with this code
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||||
|
XBox 360 Gamer
|
#include <stdio.h>
int main(void) { int a, b, c, sum; printf("Input three integers: "); scanf(%d, %d, %d, a, b, c); sum = (((a + b + c) * 2) + 7); printf("Twice the sum of your integers plus 7 is sum"); } I tried different things but it says the variables aren't defined but i thought thats what scanf was for? so in my eyes it's clearly defined, and if i change other things i get another error that pops up the "send error report" dialogue box. Anyone know what I'm doing wrong?
__________________
Read and heed, The Forum T S!!!Trouble finding the FAQ page? Go Here Help us, help you. Fill out your System Specs. New to the art of Overclocking? Read these to get you started in the right direction. AMD Intel XBox Live Gamertag: Wikk3d
|
|||||||||||||
|
|
|
|
#2 (permalink) | |||||||||||||
|
serial badger molester
![]() |
Why you put int before main(void)?
__________________
|
|||||||||||||
|
|
|
|
#3 (permalink) | ||||||||||||||
|
Bifford
![]() |
Quote:
__________________
Helpful Posts (Hopefully )Overclocker's Calculator Photo Editing - B&W w/Color Accents
Last edited by BFRD : 06-10-05 at 06:43 PM. |
||||||||||||||
|
|
|
|
#4 (permalink) | |||||||||||
|
4.0ghz
|
i'm a noob. slay me. this post isn't worth taking up your screen, so i deleted it.
better post can be found below ![]()
__________________
Overclocking in a nutshell: CyberDruid's BOOK | EvilXP's List of OCing Guides | DeathONator's Ultimate Overclocking Guide | The TOS Quote:
Last edited by ouroboros1827 : 06-10-05 at 07:06 PM. |
|||||||||||
|
|
|
|
#5 (permalink) | |||||||||||||
|
serial badger molester
![]() |
I was gonna say, never seen it done like that...
void main() or void main(void) I think?
__________________
|
|||||||||||||
|
|
|
|
#6 (permalink) | |||||||||||||
|
XBox 360 Gamer
|
none of that is working for some reason. the reason i have it set up in that manner (int main(void)) is because thats how the text states to write it up. originally when i built the program it gave me a couple of errors but i was missing a quotation mark and a semicolon. after that it built fine but the error was when i went to debug it. it would display the user input line and when i hit enter it would fail.
__________________
Read and heed, The Forum T S!!!Trouble finding the FAQ page? Go Here Help us, help you. Fill out your System Specs. New to the art of Overclocking? Read these to get you started in the right direction. AMD Intel XBox Live Gamertag: Wikk3d
|
|||||||||||||
|
|
|
|
#7 (permalink) | |||||||||||
|
Lord of the Chicken Wings
![]() |
It doesn't look like you're using scanf correctly. Take a look at this page for some tips and examples on scanf:
http://www.cplusplus.com/ref/cstdio/scanf.html
__________________
Vulcan Dragon Core i7 920 @ 3.8 GHz Currently Playing: Grand Theft Auto 4 (X360); Rock Band 2 (X360); Far Cry 2 (PC) XBox Live Gamertag: Vulcan Draggon
|
|||||||||||
|
|
|
|
#8 (permalink) | ||||||||||||||
|
XBox 360 Gamer
|
Quote:
__________________
Read and heed, The Forum T S!!!Trouble finding the FAQ page? Go Here Help us, help you. Fill out your System Specs. New to the art of Overclocking? Read these to get you started in the right direction. AMD Intel XBox Live Gamertag: Wikk3d
|
||||||||||||||
|
|
|
|
#9 (permalink) | |||||||||||
|
4.0ghz
|
alright. i think i have regained some knowledge through this. thank you.
FIXED NEW code attached.
__________________
Overclocking in a nutshell: CyberDruid's BOOK | EvilXP's List of OCing Guides | DeathONator's Ultimate Overclocking Guide | The TOS Quote:
|
|||||||||||
|
|
|
|
#10 (permalink) | |||||||||||||
|
XBox 360 Gamer
|
Thanks guys, all your inputs have helped. I'm still having one more problem though. The sum won't print. when i use %d in front of sum it kicks out some kind of crazy number that isn't correct. it should be 31, but i'm getting like 21XXX. any other ideas?
__________________
Read and heed, The Forum T S!!!Trouble finding the FAQ page? Go Here Help us, help you. Fill out your System Specs. New to the art of Overclocking? Read these to get you started in the right direction. AMD Intel XBox Live Gamertag: Wikk3d
|
|||||||||||||
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|