U E D R , A S I H C RSS

USACO Your Ride/신진영

No older revisions available

No older revisions available



~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;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:18
Processing time 0.0270 sec