bool VncViewerConfigDialog::isInputValid()
{
  if (!testNum(&m_listenPort, _T("Listen port"))) {
    return false;
  }
  if (!testNum(&m_logLevel, _T("Log level"))) {
    return false;
  }
  if (!testNum(&m_historyLimit, _T("History limit"))) {
    return false;
  }
  return true;
}
Example #2
0
int main(int argc, char** argv) {
    char number[10];
    char position[10];
    printf("Enter a number: ");
    fgets(number, 10, stdin);
    printf("Which position in number you want to display?: ");
    fgets(position, 10, stdin);
    testNum(number, position);
    return (EXIT_SUCCESS);
}
Example #3
0
int testLegel(char* s){
	int i = 0;
	if(s[0] == '\0'){
		return 0;
	}
	while(1){
		if(s[i] == '\0')
			return 1;
		if(testNum(s[i]) == 0)
			return 0;
		i++;
	}
	return 1;
	
}
Example #4
0
int main()
{
    const int SIZE = 8; //Array size
    char customer[SIZE];    // To hold the customers' number

    // Get the customer number
    std::cout << "Enter a customer number in the form ";
    std::cout << "LLLNNNN\n";
    std::cout << "(LLL = letters and NNNN = numbers): ";
    std::cin.getline(customer, SIZE);

    // Determine if the input is valid
    if (testNum(customer, SIZE))
        std::cout << "That's a valid customer number. \n";
    else
    {
        std::cout << "That's not a valid customer number, ";
        std::cout << "please use the correct format of LLLNNNN.\n";
        std::cout << "EX: ABC1234\n";
    }

    return 0;
}
Example #5
0
char* getAns(char* st){
	int len1 = 0;
	int len2 = 0;
	int leng = 0;
	char ans[101];
	while(st[leng] != '\0'){
		leng++;
	}
	char num1[100];
	char num2[100];
	int i;
	for(i =0 ; i < 100 ; i++){
		num1[i] = '\0';
		num2[i] = '\0';
		ans[i] = '\0';
	}
	ans[100] = '\0';
	int ptn = 0;
	while(testNum(st[ptn]) == 1){
		num1[ptn] = st[ptn];
		ptn++;
		len1++;
	}
	int oper;
	oper = testNum(st[ptn]);
	ptn++;
	while(testNum(st[ptn]) == 1){
		num2[len2] = st[ptn];
		ptn++;
		len2++;
	}
	if(ptn < leng++){
		return "Illegal Input";
	}
	
	if(len1 > len2){
		int k = 0;
		int flag = 0;
		while(len2 != 0){
			int temp = addTwoChar(num1[len1-1],num2[len2-1]);
			if (flag == 1)
				temp++;
			flag = 0;
			if(temp >= 10)
				flag = 1;
			int gewei = temp%10;
			ans[len1 - 1] = (char)(gewei+48);
			len1--;
			len2--;
		}
		if(flag == 1){
			ans[len1-1] = (char)(1+num1[len1-1]);
			len1--;
		}
		while(len1 != -1){
			//printf(" ans num1: %d %c\n",len1,num1[len1]);
			ans[len1-1] = num1[len1-1];
			len1--;
		}
		return ans;
	}
	return "Heheda";
	
}