From: "Perhe Virolainen" Newsgroups: comp.os.msdos.djgpp References: <88q38n$6cf$1 AT news3 DOT infoave DOT net> Subject: Re: Newbies need help too! Lines: 56 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Message-ID: Date: Sat, 26 Feb 2000 21:56:50 +0200 NNTP-Posting-Host: 212.38.225.191 X-Trace: uutiset 951595250 212.38.225.191 (Sat, 26 Feb 2000 18:00:50 GMT) NNTP-Posting-Date: Sat, 26 Feb 2000 18:00:50 GMT Organization: NIC Tietoverkot Oy - NIC Data Networks Ltd. To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Nite Hawk wrote in message :88q38n$6cf$1 AT news3 DOT infoave DOT net... > 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) > 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. > > Please help me!!!!!! > thankyou so very much and please do not laugh at my ignorence! I will not laugh. Answer for problem 1: taxPercent/100 Are you sure that tax percent is not an integrer (I'm quite sure that taxPercent is not over 100). Integers CAN NOT hold any decimals. Use double or float. Answer for problem 2: If you want to store strings use char[]; like this for C++: #include int main() { char name[50]; // Remeber to hold enough room to '\0' cout<<" Please enter your name\n"; cin >> name; cout << "\nYour name is: "< void main(void) { char name[50]; /* Remeber to hold enough room to '\0' */ printf("Please enter your name\n"); gets(name); printf("\nYour name is: %s",name); }