int factor(long innum)
{
int prev = 0;
ofstream factors;
factors.open("factors.txt");
if (factors.is_open())
{
factors << "Factors of " << innum << ":" << endl << endl;
for (long loops = 1; loops <= innum; loops++)
{
if (innum % loops == 0)
{
factors << loops << " ";
prev++;
}
if (prev == 7)
{
factors << endl;
prev = 0;
}
}
}
else
{
clearscreen
wait
cout << "Error opening file!!!" << endl << "Exiting...";
return(1);
}
factors.close();
return(0);
}

char input; cin>>input; testinputaboutascii(); Convert char to int (sprintf should work)

// testingchar.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
char * input = "a";
int counter = 0;
cin.getline(input, 20);
while (input != "\0")
{
cout << input[counter] << endl;
counter++;
}
return 0;
}
#include "windows.h"
#include "stdio.h"
#include "iostream"
using namespace std;
char input[20];
bool checkchar(char * in)
{
while(*in != 0)
{
if(*in < 0x30 || *in > 0x39)
{
return false;
}
in++;
}
return true;
}
int main()
{
cin.getline(input, 20);
if(checkchar(input))
{
cout<<"You entered only numbers - OK"<<endl;
}
else
{
cout<<"You entered NOT only numbers - FAIL"<<endl;
}
system("PAUSE");
return 0;
}

