Continous loop

This is a discussion on Continous loop within the Linux Programming forums, part of the Platform Specific Boards category; Im writing a programm to find the area of a triangle.I do this by entering 6 ints which are the ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    2

    Continous loop

    Im writing a programm to find the area of a triangle.I do this by entering 6 ints which are the 3 cordinates of the triangle.I put the the ints into an array.I want to know how to do a continous loop and how to end if i have exactly 6 cordinates or enough to perform function.

  2. #2
    Ian
    Ian is offline
    Registered User
    Join Date
    Oct 2001
    Posts
    21

    do you mean a for loop?

    /*BEGIN CODE BLOCK*/
    #include <stdio.h>

    int main()
    {
    char buffer[80];
    int coordinates[6];
    int i;

    for (i=0; i<6; i++)
    {
    printf("Enter a number: ");
    fgets(buffer, 80, stdin);
    coordinates[i] = atoi(buffer);
    }
    return 0;
    }
    /*END CODE BLOCK*/
    Is that what you wanted?

    Hope it helps,
    Ian (:

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My loop within loop won't work
    By Ayreon in forum C Programming
    Replies: 3
    Last Post: 03-18-2009, 11:44 AM
  2. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 01:13 AM
  3. A somewhat bizzare problem!!! - WHILE LOOP
    By bobthebullet990 in forum C Programming
    Replies: 3
    Last Post: 03-31-2006, 07:19 AM
  4. loop issues
    By kristy in forum C Programming
    Replies: 3
    Last Post: 03-05-2005, 09:14 AM
  5. when a while loop will stop ?
    By blue_gene in forum C Programming
    Replies: 13
    Last Post: 04-20-2004, 04:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21