~cpp 
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
	ifstream fin;
	fin.open ("ridein.txt");
	char ch;
	int num1, num2;
	int mul1 = 1;
	int mul2 = 1;

	for(int i=0;i<2;i++)
	{

		do
		{
			fin.get(ch);
			cout << ch;
			if (ch == '\n')
				break;
			num1 = int(ch) - 64;
			cout << num1 << " ";
			mul1 *= num1;
		}while(ch != '\n' && ch != ' ');
		cout << "\n" << mul1 << "\n";

		do
		{
			fin.get(ch);
			cout << ch;
			if (ch == '\n' || ch == ' ')
				break;
			num2 = int(ch) - 64;
			cout << num2 << " ";
			mul2 *= num2;
		}while(ch != '\n' && ch != ' ');
		cout << "\n" << mul2 << "\n";
	}

	fin.close();
	
	return 0;
}
Retrieved from http://wiki.zeropage.org/wiki.php/USACOYourRide/신진영
last modified 2021-02-07 05:28:18