From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: Newbies need help too! Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: References: <88q38n$6cf$1 AT news3 DOT infoave DOT net> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 37 X-Trace: /bGnt8m7MKZenN7jxJCvaAxNRyrUBy65noh3tT0tThqZJOmCJuH7m+ezex24Km+2CHR7JKprRH2r!agm3xvm/KdnALuQENHKP88kVSffw593nDzAly+9ysmuz5HqhoSNbiDERLE64Rtn29bg116vSAJsW!jSB4Fhk= X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Mon, 21 Feb 2000 03:08:13 GMT Distribution: world Date: Mon, 21 Feb 2000 03:08:13 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sun, 20 Feb 2000 20:11:25 -0500, "Nite Hawk" wrote: >Ok so i'm a newbie but please help me out! Here is 2 problems I'm having >(god is this embarassing!) >1. when I try to divide "taxPercent/100" it's value turns out to be "0" (I'm >dividing a whole # such as 6 by 100 to get .06) Integer division rounds to 0. Try float taxFraction; taxFraction = taxPercent / 100.; >2. How do I get a variable to contain a name? (I'm trying to get a name as a >variable, is this possible?) > >I'll explain what I'm doing in #2 better: >I'm using... >int yourName; >but when the person enters his/her name it only shows the first letter of >that persons name and also it will end the program without letting you enter >the other variables in. char name[256]; puts("what's your name?"); gets(name); You're trying to learn how to do portable things. It looks like you need alt.comp.lang.learn.c-c++ -- Damian Yerrick http://yerricde.tripod.com/ Comment on story ideas: http://home1.gte.net/frodo/quickjot.html AOL is sucks! Find out why: http://anti-aol.org/faqs/aas/ View full sig: http://www.rose-hulman.edu/~yerricde/sig.html This is McAfee VirusScan. Add these two lines to your .sig to prevent the spread of .sig viruses. http://www.mcafee.com/