PDA

View Full Version : Continous loop



johann
10-10-2001, 02:12 PM
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.

Ian
10-10-2001, 03:24 PM
/*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 (: