Скачиваний:
33
Добавлен:
10.05.2014
Размер:
695 б
Скачать
#include <iostream>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <limits>
#include "math.h"

using namespace std;

char str[7];

int mult(char x[])
{
	int i,l;
	unsigned long tmp1,tmp2;
	float tmp;
	l=strlen(x);
	//tmp=pow(1000,l);
	tmp=0;
	for (i=0; i<l; i++)
	{
		tmp=tmp+str[i]*pow(1000,i);
		//cout<<tmp<<" "<<str[i]<<endl;;
	}
	tmp=tmp*tmp;
	//cout<<endl<<tmp<<endl;
	tmp1=(tmp/pow(1000,l));
	tmp1=tmp1%10;
	tmp2=tmp1*10;
	//cout<<tmp1<<endl;
	tmp1=(tmp/pow(1000,l)/10);
	tmp1=tmp1%10;
	tmp2=tmp2+tmp1;
	//cout<<tmp1<<endl;
	//cout<<tmp2<<endl;
	tmp2=tmp2%20;
	//cout<<tmp2<<endl;
	return tmp2;
}

int main(void)
{
	strcpy(str,"ayfg");
	cout<<mult(str);
	return 0;
}
Соседние файлы в папке 3