#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main(void)
{
	int actid;

	cin >> actid;
	if(actid != 1,2,3,4,5,6,7,8,9,0)
	{
		cout << "you must enter an integer";
		return 0;
	}
}

but it's fail :(

Commas won't work here. You want &&.

if(actid != 1 && actid != 2 && actid != 3)
{
    cout << "you must enter an integer";
    return 0;
}

Checks for 1, 2, 3. Add to it for the other digits.

#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main(void)
{
	int actid;

	cin >> actid;
	if(actid != 1,2,3,4,5,6,7,8,9,0)
	{
		cout << "you must enter an integer";
		return 0;
	}
}

but it's fail :(

i also tried

#include <algorithm>
#include <iostream>
#include <Windows.h>
#include <string>
#include <cctype>
using namespace std;

int main(void)
{
	int test;
	cin >> test;
	while ((isdigit(test))==0)
	{
		cout << "enter a number";
		cin >> test;
	}
}

Commas won't work here. You want &&.

if(actid != 1 && actid != 2 && actid != 3)
{
    cout << "you must enter an integer";
    return 0;
}

Checks for 1, 2, 3. Add to it for the other digits.

i need him to enter like 10 digits like 45124648 so i wanna check if its a letter it will cout enter number got me !?

This is what I came up with. The code works for any valid input from 1 - 9. You can change the range from a number higher than 9 or lower than 1.

#include<iostream>
using namespace std;


int main(){

	int number;

	cout << "Please input a number 1 - 9.\n";
	cin >> number;

	if(number < 1 || number > 9){
		cout << "Input valid number between 1 - 9.\n";
		exit(1);
	}

	cout << "You input was " << number << endl;

	return 0;
}

This is what I came up with. The code works for any valid input from 1 - 9. You can change the range from a number higher than 9 or lower than 1.

#include<iostream>
using namespace std;


int main(){

	int number;

	cout << "Please input a number 1 - 9.\n";
	cin >> number;

	if(number < 1 || number > 9){
		cout << "Input valid number between 1 - 9.\n";
		exit(1);
	}

	cout << "You input was " << number << endl;

	return 0;
}

you got me wrong all i need to do is to check if the user enetered a number or latter
coz i want the user to input more than 10 numbers like 123456789 if he made it like this
123456789a it will say invaild input only numbers allowed , i wont make a range for the numbers all the numbers allowed even if he typied like 1000000000 it will work but if it has one letter/char it will say invalid input got me now?

i need him to enter like 10 digits like 45124648 so i wanna check if its a letter it will cout enter number got me !?

Then you need to have the user enter his/her input into a string or a char*, not an int.

string temp;
cin >> temp;

// now go through temp a character at a time and check for digits using isdigit
// if any non-digit characters exist, give the error message.

// after the test passes, convert temp to an integer using atoi or strtol or whatever.

Then you need to have the user enter his/her input into a string or a char*, not an int.

string temp;
cin >> temp;

// now go through temp a character at a time and check for digits using isdigit
// if any non-digit characters exist, give the error message.

// after the test passes, convert temp to an integer using atoi or strtol or whatever.

gotcha thnx :)

This question has already been answered. Start a new discussion instead.