📄 074256_5.cpp
字号:
//074256_5.cpp
//To read how many cols and rows in the Matrix
#include"074256_1.h"
void read_cr(int *row,int *col)
{
int ok_row=0;
int ok_col=0;
for(;;)
{
printf("\tHow many rows:\n\t");
ok_row=scanf("%d",row);
clean();
printf("\tHow many colums:\n\t");
ok_col=scanf("%d",col);
clean();
printf("\n");
//judge if the number of rows and colums is reasoniable
if(!(ok_row&&ok_col)) //judge if a digit or not
{
printf("\t-------> Bad Data!\n");
printf("\t\tPlease input a digit ( an intager ) !\n\n");
}
else if((*row<=0)||(*col<=0)) //judge if positive or not
{
printf("\t-------> Bad Data!\n\tThe error data:%d,%d\n",*row,*col);
printf("\t\tThe number shoud be positive!\n\n");
}
else
{
printf("\t--------> OK.\trow = %d , col = %d\n\n",*row,*col);
break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -