[Courses] [C] Beginner's Lesson Five: Decision and Control Statements
Claire .
angelfly91 at hotmail.com
Fri Oct 11 18:44:55 EST 2002
The += is a short way of adding for example "x+=y" is the same as "x+y=x". The same applies for multiplication and subtraction."x*=y" is the same as "x*y=x".Hope that clears it up for you
----- Original Message -----
From: Morgon Kanter
Sent: Friday, October 11, 2002 5:44 PM
To: courses at linuxchix.org
Subject: Re: [Courses] [C] Beginner's Lesson Five: Decision and Control Statements
>#include <stdio.h>
>int main(void)
>{
> char line[100]; /* line for data input */
> int total; /* running total of numbers */
> int item; /* next item to add to list */
>
> total = 0;
> while (1)
> {
> printf("Enter # to add\n");
> printf(" or 0 to stop: ");
> fgets(line, sizeof(line), stdin);
> sscanf(line, "%d", &item);
> if (item == 0)
> break;
> total += item;
> printf(Total: %d\n", total);
> }
> printf("Final total %d\n", total);
> return (0);
>}
Um, what does the += operator do?
_______________________________________________
Courses mailing list
Courses at linuxchix.org
http://mailman.linuxchix.org/mailman/listinfo/coursesGet more from the Web. FREE MSN Explorer download : http://explorer.msn.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linuxchix.org/pipermail/courses/attachments/20021011/cbcb9941/attachment.xhtml
More information about the Courses
mailing list