[ create a new paste ] login | about

Link: http://codepad.org/Io96NBri    [ raw code | output | fork ]

hoaithu.melody - C++, pasted on Mar 9:
//GNS
#include <iostream>
#include <stdio.h>
#include <string>
#include <conio.h>

using namespace std;

int main()
{
	freopen("Testcase.txt", "r", stdin);
	string arrBase[10] = {"ZRO", "ONE", "TWO", "THR", "FOR", "FIV", "SIX", "SVN", "EGT", "NIN"};
	int n;
	cin >> n;
	for(int testcase = 1; testcase <= n; testcase++)
	{
		string testcaseNum;
		int len, i, j;
		string arrNum[10000];
		int count[10];
		cin >> testcaseNum;
		cin >> len;
		for(i = 0; i < len; i++)
			cin >> arrNum[i];
			/*fgets(arrNum[i], 4, stdin);*/

		for(i = 0; i < 10; i++)
			count[i] = 0;

		for(i = 0; i < len; i++)
		{
			int flag = 0;
			for(j = 0; j < 10; j++)
			{
				if(arrNum[i].compare(arrBase[j]) == 0)
				{
					flag = 1;
				}
				if(flag == 1)
					count[j]++;
			}
		}

		cout << testcaseNum << " ";
		for(i = 0; i < 10; i++)
			for(j = 1; j <= count[i]; j++)
			{
					cout << arrBase[i];
				cout << " ";

			}
		cout << endl;
	}
	getch();
	return 0;
}


Output:
1
2
3
4
Line 18: error: conio.h: No such file or directory
In function 'int main()':
Line 54: error: 'getch' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: