Im having a problem with this program in which I want to test if a function (math function) is a function by a set of ordered pairs. To accomplish this I need to place the x and y values into separate arrays.
I get the problem after the if statement testing for punctuation.Code:#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define MAX 20
#define ORP MAX/2
int main()
{
char pair[MAX];
int i, l, k;
int x[ORP], y[ORP];
printf("Enter a set of ordered pairs: ");
fgets( pair, sizeof(pair), stdin);
atoi(pair);
for (i=0 ; i != '\0'; i++)
{
if ( ispunct(i) != 0 )
{
x[i]=pair[i-1];
y[i]=pair[i+1];
}
else
{
printf("You need commas to enter ordered pairs\n");
getch();
return 1;
}
}
//------------CUT HERE--------------//