U E D R , A S I H C RSS

알고리즘8주숙제/test

코드

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

ofstream fout("test.txt");

int main()
{
	srand(time(NULL));
	int numCase;
	cout << "Case의 수를 입력 :\n";
	cin >> numCase;
	fout << numCase << endl;
	
	int alph, priority, temp;
	char c;

	for (int i = 1; i <= numCase; i++)
	{
		alph = rand() % 1000;
		priority = rand() % 1000;
		while (alph != 0)
		{
			temp = alph % 26;
			c = 'a' + temp;
			alph /= 26;
			fout << c;
		}
		fout << " " << priority << " ";
		if (i % 10 == 0)
			fout << endl;
	}
	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:21
Processing time 0.0107 sec