//
// Torbert, 9.14.2009
//
// miscellaneous.c
//
// Reads in 10 characters from standard input.
// Prints a table of char, ASCII value, sqrt.
// Then prints out the entire null-terminated string.
//

#include <stdio.h>
#include <string.h>
#include <math.h>

#define N 10

int main(int argc, char* argv[])
{
	char   str[N+1]; // array's type is char*, say "char-star"
	char   ch;
	int    k,n;
	double z;

	for(k=0; k<N; k++)
	{
		str[k]=getchar();
		ch=str[k];
		n=(int)ch;
		z=(double)n;
		printf("\t\tch=%c, val=%3d, sqrt=%4.1f\n",ch,n,sqrt(z));
	}		
	str[N]='\0';
	printf("%s (%d)\n\n",str,strlen(str));

	return 0;
}
