PSP3D Left Header
PSP3D Header Right
PSP3D Logo CraveOnline Logo
Help the PSP 3D community grow!
Vote for us below:


Vote on the PSP Top 200
PSP Top 200 - Games, Videos, Wallpapers, Files, Hacks, Homebrew

Off Topic - Topics not of/relating to the PSP.

Welcome to PSP3D.com - Sony PlayStation Portable News, Homebrew, Hacks, Reviews, Videos, Mods, Forums!

You are currently viewing our website as a guest, which gives you limited access to reply and interact to discussions and other members. By joining our free community, you will be able to post topics in the forums, communicate privately with other members, vote in polls, and access many other special features.

Registration is fast, simple, and absolutely free so join our community today!

Go Back PSP3D.com - Sony PlayStation Portable News, Homebrew, Hacks, Reviews, Videos, Mods, Forums > Main > Off Topic
Tags: assignment


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-01-2008, 08:12 PM
nashsclay's Avatar
nashsclay nashsclay is offline
Senior Member
My Mood:
 
Join Date: Dec 2005
Location: Sioux Falls, SD
Age: 19
Posts: 275
Points: 12.55
Donate
Send a message via AIM to nashsclay Send a message via ShopTapNham to nashsclay Send a message via Yahoo to nashsclay
Exclamation NEED help with C programming assignment!

Hey all. It's been forever since I've been on last, anywho... I'm working on a programming assignment for school. The language is C . I don't know much about C but any help will be greatly appreciated! Here is the question:

Write a program that defines five integer variables and initializes them to 1, 10, 100, 1000, 10000. It then prints them on a single line separated by space characters using the decimal conversion code (%d), and on the next line with the float conversion code (%f). Note the differences between the results.

Ok now here is my code so far
Code:
#include <stdio.h> int main (void) { int i1,i2,i3,i4,i5; i1=1, i2=10, i3=100, i4=1000, i5=10000; printf("\n%d %d %d %d %d\n", i1, i2, i3, i4, i5); printf("%f %f %f %f %f", i1, i2, i3, i4, ,i5); return 0; }
and the output is this
1 10 100 1000 10000
0.000000 0.000000 0.000000 0.000000 0.000000

Any help would be amazing!
__________________

+Field Commander
+Lord of the Rings: Tactics
+Daxter
+World Tour Soccer
http://sio.midco.net/inash/numa/Numa%20Nate_2005.wmv

MY NUMA NUMA VIDEO! WATCH IT!
Reply With Quote
  #2 (permalink)  
Old 02-02-2008, 09:12 AM
Percival's Avatar
Percival Percival is offline
Moderator
My Mood:
 
Join Date: Dec 2005
Location: Earth
Age: 26
Posts: 336
Points: 41.03
Donate
%f expects a float. Maybe you could cast the integer variables into floats?
Code:
printf("%f %f %f %f %f", (float)i1, (float)i2, (float)i3, (float)i4, (float)i5);
__________________
Look below for my signature.
Look above for my signature.
Reply With Quote
  #3 (permalink)  
Old 02-02-2008, 09:15 AM
iamstrange14's Avatar
iamstrange14 iamstrange14 is offline
PSP3D's Strangest Member
My Mood:
 
Join Date: Nov 2005
Location: Ca$hville
Age: 16
Posts: 774
Points: 2.81
Donate
Send a message via AIM to iamstrange14 Send a message via ShopTapNham to iamstrange14 Send a message via Yahoo to iamstrange14
hmmm. i have no idea how to fix that, but i dont think you should be voiding int main
__________________
Think outside the cubical triangle

wilhel1812 is my hero!

Join my site! http://uberforumz.com

Thanks to pspkillsds for 250 points!
Thanks to zzaz3 for 59,000 points!


Reply With Quote
  #4 (permalink)  
Old 02-02-2008, 06:05 PM
nashsclay's Avatar
nashsclay nashsclay is offline
Senior Member
My Mood:
 
Join Date: Dec 2005
Location: Sioux Falls, SD
Age: 19
Posts: 275
Points: 12.55
Donate
Send a message via AIM to nashsclay Send a message via ShopTapNham to nashsclay Send a message via Yahoo to nashsclay
Thanks for the help. Yep i did some more google search and found that last night. Thanks alot though!
__________________

+Field Commander
+Lord of the Rings: Tactics
+Daxter
+World Tour Soccer
http://sio.midco.net/inash/numa/Numa%20Nate_2005.wmv

MY NUMA NUMA VIDEO! WATCH IT!
Reply With Quote
Reply

« computer erases files? | Video Folders on iPod :/ »



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 0.00
Points Per Thread: 1.00
Points Per Reply: 0.10

Similar Threads
Thread Thread Starter Forum Replies Last Post
PSP Programming Tutorials: Lua Programming! Robert A. Homepage News 7 02-03-2006 09:16 AM
PSP Programming Tutorials: Lesson 05 Released! Robert A. Homepage News 4 01-21-2006 10:27 PM
Just started programming C++N0ob! Off Topic 1 01-15-2006 07:03 PM
* Post programming files * B_a_n_a_n_a_s Homebrew/Hacking 18 12-09-2005 03:27 PM
* Post programming files * B_a_n_a_n_a_s General PSP Discussion 0 12-06-2005 11:07 PM





Crave Partner Sites: CraveOnline.com | DVDFile.com | PSP3D.com | ComingSoon.net | SuperHeroHype.com | RedBalcony.com | ActionTrip.com | CraveLyrics.com
Soundtrack.net | CraveFix.com | SpikedHumor.com | RPGamer.com | TattooNow.com | ImpactWrestling.com | SeekLyrics.com | PedalBMX.com | WildKO.com
vidKing.com | StrategyInformer.com | HHdb.com | RapLeagues.com | HipHop-Lyrics.com | Cravecocktails.com | ThePhatPhree.com | RideJudge.com | HottieSpots.com

ShopTapNham Shop Online Powered by Custom vB Version 5.1.0 for Crave Online Media, LLC.
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd. and PSP3D.com.
LinkBacks Enabled by vBSEO 3.0.0 RC8

All times are GMT -4. The time now is 10:12 PM.
ShopTapNham Footer Right