/*
* Copyright and version Declaration of the program:
* Copyright (c) 2012, computer College, Yantai University
* All rights reserved.
* File name: [array] determines the number of digits of a file. cpp
* Author: Mao Tong
* Completion date: January 1, December 5, 2012
* Version No.: v1.0
* Description of tasks and solutions: character array
* Input Description: enter an integer of no less than five digits.
* Problem description: character array
* Program output: "This is the number of digits"
* Problem Analysis: omitted
* Algorithm Design: omitted
*/
# Include <iostream>
Using namespace std;
Int main ()
{
Int I, j;
Char a [5];
Cout <"enter an integer not greater than five digits :";
For (I = 0; I <= 4; I ++)
{
A [I] = getchar ();
If (a [I] = '\ n ')
Break;
}
Cout <"this is a" <I <"digit" <endl;
Cout <"Each digit is :";
For (j = 0; j <= I-1; j ++)
{
Cout <a [j] <"";
}
Cout <endl;
Cout <"reverse output :";
For (j = I-1; j> = 0; j --)
Cout <a [j] <"";
Cout <endl;
Return 0;
}
/*
Running result:
Experience: Remember to use getchar for the char type
*/