📄 menu.c
字号:
int scanf05(USI *iptr, USI *jptr, USI *kptr, USI *lptr, USI *mptr)
/*
* returns 1 if unsigned ints *iptr, *jptr, *kptr, *lptr, *mptr with
* *iptr, *jptr, *kptr, *lptr and *mptr < M0 are successfully entered,
* 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u%u%u", iptr, jptr, kptr, lptr, mptr);
Flush();
if (n == 5)
{
if (*iptr < M0 && *jptr < M0 && *kptr < M0 && *lptr < M0 && *mptr < M0)
return 1;
else
printf("one of %u, %u, %u, %u and %u exceeded array bound %u, try again:\n", *iptr, *jptr, *kptr, *lptr, *mptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf051(USI *iptr, USI *jptr, USI *kptr, USI *lptr, USI *mptr, USI *nptr)
/*
* returns 1 if unsigned ints *iptr, *jptr, *kptr, *lptr, *mptr, *nptr with,
* *iptr, *jptr, *kptr, *lptr and *mptr < M0 are successfully entered,
* 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u%u%u%u", iptr, jptr, kptr, lptr, mptr, nptr);
Flush();
if (n == 6)
{
if (*iptr < M0 && *jptr < M0 && *kptr < M0 && *lptr < M0 && *mptr < M0)
return 1;
else
printf("one of %u, %u, %u, %u and %u exceeded array bound %u, try again:\n", *iptr, *jptr, *kptr, *lptr, *mptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf10(USI *jptr)
/*
* returns 1 if unsigned int *jptr successfully, 0 otherwise.
*/
{
int n;
n = scanf("%u", jptr);
Flush();
if (n == 1)
return 1;
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanfd10(int *jptr)
/*
* returns 1 if int *jptr successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%d", jptr);
Flush();
if (n == 1)
return 1;
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf11(USI *jptr, USI *kptr)
/*
* returns 1 if unsigned ints *jptr, *kptr with *kptr < M0 are successfully
* entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u", jptr, kptr);
Flush();
if (n == 2)
{
if (*kptr < M0)
return 1;
else
printf("second integer %u exceeded array bound %u, try again:\n", *kptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf12(USI *jptr, USI *kptr, USI *lptr)
/*
* returns 1 if unsigned ints *jptr, *kptr, *lptr with *kptr and *lptr < M0
* are successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u", jptr, kptr, lptr);
Flush();
if (n == 3)
{
if (*kptr < M0 && *lptr < M0)
return 1;
else
printf("second integer %u or third integer %u exceeded array bound %u, try again:\n", *kptr, *lptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf012(USI *jptr, USI *kptr, USI *lptr)
/*
* returns 1 if unsigned ints *jptr, *kptr, *lptr with *jptr < M0 are
* successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u", jptr, kptr, lptr);
Flush();
if (n == 3)
{
if (*jptr < M0)
return 1;
else
printf("first integer %u exceeded array bound %u, try again:\n", *jptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf0112(USI *jptr, USI *kptr, USI *lptr, USI *mptr)
/*
* returns 1 if unsigned ints *jptr, *kptr, *lptr, *mptr with
* jptr < M0, *lptr < M0, *mptr < M0 are successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u%u", jptr, kptr, lptr, mptr);
Flush();
if (n == 4)
{
if (*jptr < M0 && *lptr < M0 && *mptr < M0)
return 1;
else
printf("one of %u, %u and %u exceeded array bound %u, try again:\n", *jptr, *lptr, *mptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf0122(USI *jptr, USI *kptr, USI *lptr, USI *mptr, USI *nptr)
/*
* returns 1 if unsigned ints *jptr, *kptr, *lptr, *mptr, *nptr with
* *jptr < M0, *mptr < M0, *nptr < M0 are successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u%u%u", jptr, kptr, lptr, mptr, nptr);
Flush();
if (n == 5)
{
if (*jptr < M0 && *mptr < M0 && *nptr < M0)
return 1;
else
printf("one of %u, %u and %u exceeded array bound %u, try again:\n", *jptr, *mptr, *nptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf01221(USI *jptr, USI *kptr, USI *lptr, USI *mptr, USI *nptr, USI *optr)
/*
* returns 1 if unsigned ints *jptr, *kptr, *lptr, *mptr, *nptr, *optr
* with *jptr < M0, *mptr < M0, *nptr < M0 successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u%u%u%u", jptr, kptr, lptr, mptr, nptr, optr);
Flush();
if (n == 6)
{
if (*jptr < M0 && *mptr < M0 && *nptr < M0)
return 1;
else
printf("one of %u, %u and %u exceeded array bound %u, try again:\n", *jptr, *mptr, *nptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf22(USI *iptr, USI *jptr, USI *kptr, USI *lptr)
/*
* returns 1 if unsigned ints *iptr, *jptr, *kptr, *lptr with *kptr and
* *lptr < M0 are successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u%u", iptr, jptr, kptr, lptr);
Flush();
if (n == 4)
{
if (*kptr < M0 && *lptr < M0)
return 1;
else
printf("third integer %u or fourth integer %u exceeded array bound %u, try again:\n", *kptr, *lptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf20(USI *iptr, USI *jptr)
/*
* returns 1 if unsigned ints *iptr, *jptr successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u", iptr, jptr);
Flush();
if (n == 2)
return 1;
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf30(USI *iptr, USI *jptr, USI *kptr)
/*
* returns 1 if unsigned ints *iptr, *jptr, *kptr are succesfully entered,
* 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u", iptr, jptr, kptr);
Flush();
if (n == 3)
return 1;
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf40(USI *iptr, USI *jptr, USI *kptr, USI *lptr)
/*
* returns 1 if unsigned ints *iptr, *jptr, *kptr, *lptr are successfully
* entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u%u", iptr, jptr, kptr, lptr);
Flush();
if (n == 4)
return 1;
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf23(USI *iptr, USI *jptr, USI *kptr, USI *lptr, USI *mptr)
/*
* returns 1 if unsigned ints *iptr, *jptr, *kptr, *lptr, *mptr with
* *kptr, *lptr and *mptr < M0 are successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u%u%u", iptr, jptr, kptr, lptr, mptr);
Flush();
if (n == 5)
{
if (*kptr < M0 && *lptr < M0 && *mptr < M0)
return 1;
else
printf("one of %u, %u and %u exceeded array bound %u, try again:\n", *kptr, *lptr, *mptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf231(USI *iptr, USI *jptr, USI *kptr, USI *lptr, USI *mptr, USI *nptr)
/*
* returns 1 if unsigned ints *iptr, *jptr, *kptr, *lptr, *mptr, *nptr with
* *kptr, *lptr and *mptr < M0 are successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u%u%u%u", iptr, jptr, kptr, lptr, mptr, nptr);
Flush();
if (n == 6)
{
if (*kptr < M0 && *lptr < M0 && *mptr < M0)
return 1;
else
printf("one of %u, %u and %u exceeded array bound %u, try again:\n", *kptr, *lptr, *mptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
int scanf13(USI *iptr, USI *jptr, USI *kptr, USI *lptr)
/*
* returns 1 if unsigned ints *iptr, *jptr, *kptr, *lptr with
* *jptr, *kptr and *lptr < M0 are successfully entered, 0 otherwise.
*/
{
int n;
n = scanf("%u%u%u%u", iptr, jptr, kptr, lptr);
Flush();
if (n == 4)
{
if (*jptr < M0 && *kptr < M0 && *lptr < M0)
return 1;
else
printf("one of %u, %u and %u exceeded array bound %u, try again:\n", *jptr, *kptr, *lptr, M0 - 1);
}
else
printf("try again:\n");
GetReturn();
return 0;
}
FILE *Fopen_r(char *filename)
/*
* An attempt is made at opening the file specified for reading. If successful,
* a pointer to the file is returned, otherwise a null pointer is returned.
*/
{
FILE *f;
if ((f = fopen(filename, "r")) == NULL)
{
fprintf(stderr, "cmat: ");
perror(filename);
exit(1);
}
return f;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -