The Open Source Swiss Army Knife

/code/cPP/basics_cPP/
/code/cPP/basics_cPP/ + sub-categories
http://www.sirfsup.com/
web directory content
    
      

Not logged in
Chat Register Login
return to:  http:/www.sirfsup.com      /code   /cPP   /basics_cPP 
Permalink: alpha_test.c
Title: add
article options : please login   |  raw source view  

#include <stream.h>

int main()  {
	char year;

	cout << "please give me the year (4-digit year) =====>  ";
	cin >> year;  

     if (isalpha (year)) {
       cout << "The character " << year << "is \"isalpha\""; }
      else {
       cout << "The character " << year << "is not \"isalpha\""; }
}
################################################################################
cout << "Enter a number and a symbol and another number" << flush;
cin >> num1;
void getfloat(float & num1) {
	char dummy;  // reads from buffer into dummy in order to clear buffer
	while (cin.fail()) {
		cin.clear(); //if don't clear flag ignores all subsequent reads
		cin >> dummy;
// 		if it's a q then you can exit
		cin >> num1;
	}
	return;
}

Leave a Reply
Your Name:     anonymous
Your Email:
Website:  
Comments:

The author will be notified of your reply.
return to top