<commit_before># Script to convert questions in a .txt file to a .cpp file where they
# are stored in a struct

ques_cpp = open("ques.cpp", 'w');

ques_cpp.write('#include "quiz.h"\n')
ques_cpp.write('#include <string.h>\n\n')
ques_cpp.write('question questions[3][3][3];\n\n')

ques_cpp.write('void init()\n{\n\n')

for n in xrange(0,3):
	if n == 0:
		ques_txt = open("q_lvl1.txt");
	elif n == 1:
		ques_txt = open("q_lvl2.txt");
	elif n == 2:
		ques_txt = open("q_lvl3.txt");
		
	for i in xrange(0,3):
		for j in xrange(0,3):
			question = ques_txt.readline()
			w = "strcpy(questions[%d][%d][%d].q, %s) ; \n" % (n, i, j, question[0:len(question) - 1])
			ques_cpp.write(w)
			for k in xrange(0, 4):
				option = ques_txt.readline()
				ques_cpp.write('strcpy(questions[%d][%d][%d].options[%d], %s) ; \n' % (n, i, j, k, option[0:len(option) - 1]))
			
			answer = ques_txt.readline()
			ques_cpp.write('questions[%d][%d][%d].correct = %s ; \n\n' % (n, i, j, answer[0:1]))
			blank = ques_txt.readline()
			
	ques_txt.close()
		
ques_cpp.write('}')
ques_cpp.close()
<commit_msg>Added a "Generated from script.py" comment<commit_after># Script to convert questions in a .txt file to a .cpp file where they
# are stored in a struct

ques_cpp = open("ques.cpp", 'w');

ques_cpp.write('/* Generated from script.py */ \n\n')

ques_cpp.write('#include "quiz.h"\n')
ques_cpp.write('#include <string.h>\n\n')
ques_cpp.write('question questions[3][3][3];\n\n')

ques_cpp.write('void init_ques()\n{\n\n')

for n in xrange(0,3):
	if n == 0:
		ques_txt = open("q_lvl1.txt");
	elif n == 1:
		ques_txt = open("q_lvl2.txt");
	elif n == 2:
		ques_txt = open("q_lvl3.txt");
		
	for i in xrange(0,3):
		for j in xrange(0,3):
			question = ques_txt.readline()
			w = "strcpy(questions[%d][%d][%d].q, %s) ; \n" % (n, i, j, question[0:len(question) - 1])
			ques_cpp.write(w)
			for k in xrange(0, 4):
				option = ques_txt.readline()
				ques_cpp.write('strcpy(questions[%d][%d][%d].options[%d], %s) ; \n' % (n, i, j, k, option[0:len(option) - 1]))
			
			answer = ques_txt.readline()
			ques_cpp.write('questions[%d][%d][%d].correct = %s ; \n\n' % (n, i, j, answer[0:1]))
			blank = ques_txt.readline()
			
	ques_txt.close()
		
ques_cpp.write('}')
ques_cpp.close()

{'fraction_non_alphanumeric': 0.21762349799732977, 'fraction_numerical': 0.020471740097908322, 'mean_word_length': 3.865800865800866, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2420576', 'n_tokens_mistral': 1057, 'n_tokens_neox': 969, 'n_words': 210}