Mail Archives: djgpp/1997/06/05/21:06:19
From: | "Cory Fahey" <cfahey AT cs DOT mun DOT ca>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Newbie Question
|
Date: | 5 Jun 1997 15:27:20 GMT
|
Organization: | Memorial University of Newfoundland
|
Lines: | 53
|
Message-ID: | <01bc71c5$0db9aee0$75629986@doh>
|
NNTP-Posting-Host: | n098h117.remote.mun.ca
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Ok guys I am just trying tolearn some of the basics of C, I looked at a few
tutorials online but none were really helpful. So I decided to just try a
sample program, The program calculates the amount owed on my house monthly
bills. An explanation of what my problems are is welcome. Also can someone
explain to me when blocks should be opened and closed. Here is the basic
code I was trying. Aslo what is the cc1plus command to make an exe from a
source called first.c ?
float rob, cory, tommy, terry, heat, robphone,
terryphone, cable, cablem, total
main()
{
printf("Enter the amount of the heat bill:");
scanf( "%f", &heat);
total = heat + 800.0;
printf("/n Enter the amount of the cable bill:");
scanf("%f", &cable);
total += cable;
printf("/n Enter the amount of the cable modem bill:");
scanf("%f", &cablem);
total += cable;
rob=total /4.0;
cory=rob;
tommy=rob;
terry=rob;
printf("/n Enter the service charge of the house phone bill:");
scanf("%f", &robphone);
robphone = robphone * 1.15;
rob=rob + robphone/3.0;
cory=cory + robphone/3.0;
tommy=tommy + tommy/3.0;
printf("/n Enter Cory's long distance:");
scanf("%f", &robphone);
cory=cory + robphone*1.15;
printf("/n Enter Rob's long distance:");
scanf("%f", &robphone);
rob=rob + robphone*1.15;
printf("/n Enter Tommy's long distance:");
scanf("%f", &robphone);
tommy= tommy + robphone*1.15;
printf("/n Enter Terry's total phone bill:");
scanf("%f", &terryphone);
terry=terry + terryphone;
printf
printf("/n Cory: %f Tommy: %f Rob: %f Terry: %f", cory, tommy, rob,
terry)
}
Any help would be great!
Thanks in advance.
- Raw text -