Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

알고리즘8주숙제/test

From ZeroWiki

코드

#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;
}

알고리즘8주숙제