U E D R , A S I H C RSS

Love Calculator/허아영

._
,,
~ ~
sample input 2 3 .; --1002

. ( , ..)

~cpp 
//LoveCalculator 

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

void get_names(char *first_person, char *second_person);
void calculator(char *first_person, char *second_person);
int sum_name(char name[25]);

void main()
{
	char first_person[30]; 
	char second_person[30]; 
	char ch;
	while((ch = getchar()) != EOF)
	{
		ungetc(ch, stdin);
		get_names(first_person, second_person);
		calculator(first_person, second_person);
	}
}

void get_names(char *first_person, char *second_person)
{
	gets(first_person);
	gets(second_person);
	if(strlen(first_person) > 25 || strlen(second_person) > 25)
	{
		get_names(first_person, second_person);
	}
}

void calculator(char *first_person, char *second_person)
{
	int first_person_sum, second_person_sum;
	float percentage;
	
	first_person_sum = sum_name(first_person);
	second_person_sum = sum_name(second_person);

	while(first_person_sum >= 10)
	{
		first_person_sum = (first_person_sum % 10) + (first_person_sum % 100) / 10 + (first_person_sum / 100);
		 // ..
	}
	while(second_person_sum >= 10)
	{
		second_person_sum = (second_person_sum % 10) + (second_person_sum % 100) / 10 + (first_person_sum / 100);
	}
	
	if(first_person_sum < second_person_sum)
	{
		percentage = (float)first_person_sum/second_person_sum;
	}else{
		percentage = (float)second_person_sum/first_person_sum;
	}
	percentage *= 100; 
	// result print
	printf("%.2f", percentage);
	printf(" %% \n");
}

int sum_name(char name[25])
{
	int sum = 0, i = 0;
	while(name[i] > 0)
	{
		if(name[i] >= 65 && name[i] <= 90)
		{
			sum = sum + name[i] - 64;
		}else if(name[i] >= 97 && name[i] <= 122)
		{
			sum = sum + name[i] - 96;
		}else{}
		++i;
	}
	return sum;
}

한테 할

Girl~ㅎ ~ ..ㅎ
?ㅎ ??( .ㅎ)
.. .ㅎ( !!킁..ㅠ.ㅜ)
.. ~ㅎ
.. 1 2 .. ..ㅎ
~ㅎ ..ㅎ ..ㅠ.ㅜㅎ -
. ㅋㅋ

tolower(해 , )함 toupper() (alpha = alpha - 'a' +1) , ? -
- . .

크크 toupper ... 'a' ... ㅠㅠ
.
; ; -;;; 흑 ㅠㅠ
gets ㅠㅠ - zyint
└ㅎㅎ getche scanf ..ㅎㅎ ..
...;;ㅁ;; 킁..ㅎ ..ㅎ -
^^;;
----
LittleAOI LoveCalculator
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:40
Processing time 0.0147 sec