i have a problem with a mikhail gorbachev trivia game, the number at the end where it tells you how many questions you got right is always wrong but i can't tell why. also how can i reset the radio buttons after each question
here is the code
#pragma once
namespace project {
int question, ranswers, answers;
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ exit;
protected:
private: System::Windows::Forms::RadioButton^ radioButton1;
private: System::Windows::Forms::RadioButton^ radioButton2;
private: System::Windows::Forms::RadioButton^ radioButton3;
private: System::Windows::Forms::RadioButton^ radioButton4;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Button^ go;
private: System::Windows::Forms::Label^ label2;
private: System::ComponentModel::IContainer^ components;
private:
/// <summary>
/// Required designer variable.
/// </summary>
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->exit = (gcnew System::Windows::Forms::Button());
this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
this->radioButton3 = (gcnew System::Windows::Forms::RadioButton());
this->radioButton4 = (gcnew System::Windows::Forms::RadioButton());
this->label1 = (gcnew System::Windows::Forms::Label());
this->go = (gcnew System::Windows::Forms::Button());
this->label2 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// exit
//
this->exit->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->exit->Location = System::Drawing::Point(497, 399);
this->exit->Name = L"exit";
this->exit->Size = System::Drawing::Size(134, 41);
this->exit->TabIndex = 0;
this->exit->Text = L"Exit";
this->exit->UseVisualStyleBackColor = true;
this->exit->Click += gcnew System::EventHandler(this, &Form1::exit_Click);
//
// radioButton1
//
this->radioButton1->AutoSize = true;
this->radioButton1->Location = System::Drawing::Point(88, 220);
this->radioButton1->Name = L"radioButton1";
this->radioButton1->Size = System::Drawing::Size(14, 13);
this->radioButton1->TabIndex = 1;
this->radioButton1->TabStop = true;
this->radioButton1->UseVisualStyleBackColor = true;
this->radioButton1->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton1_CheckedChanged);
//
// radioButton2
//
this->radioButton2->AutoSize = true;
this->radioButton2->Location = System::Drawing::Point(88, 270);
this->radioButton2->Name = L"radioButton2";
this->radioButton2->Size = System::Drawing::Size(28, 17);
this->radioButton2->TabIndex = 2;
this->radioButton2->TabStop = true;
this->radioButton2->Text = L" ";
this->radioButton2->UseVisualStyleBackColor = true;
this->radioButton2->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton2_CheckedChanged);
//
// radioButton3
//
this->radioButton3->AutoSize = true;
this->radioButton3->Location = System::Drawing::Point(88, 320);
this->radioButton3->Name = L"radioButton3";
this->radioButton3->Size = System::Drawing::Size(14, 13);
this->radioButton3->TabIndex = 3;
this->radioButton3->TabStop = true;
this->radioButton3->UseVisualStyleBackColor = true;
this->radioButton3->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton3_CheckedChanged);
//
// radioButton4
//
this->radioButton4->AutoSize = true;
this->radioButton4->Location = System::Drawing::Point(88, 370);
this->radioButton4->Name = L"radioButton4";
this->radioButton4->Size = System::Drawing::Size(14, 13);
this->radioButton4->TabIndex = 4;
this->radioButton4->TabStop = true;
this->radioButton4->UseVisualStyleBackColor = true;
this->radioButton4->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton4_CheckedChanged);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label1->Location = System::Drawing::Point(85, 57);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(128, 18);
this->label1->TabIndex = 5;
this->label1->Text = L"Press Go to begin";
this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
//
// go
//
this->go->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->go->Location = System::Drawing::Point(264, 399);
this->go->Name = L"go";
this->go->Size = System::Drawing::Size(134, 41);
this->go->TabIndex = 7;
this->go->Text = L"Go";
this->go->UseVisualStyleBackColor = true;
this->go->Click += gcnew System::EventHandler(this, &Form1::go_Click);
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(486, 119);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(0, 13);
this->label2->TabIndex = 8;
this->label2->Click += gcnew System::EventHandler(this, &Form1::label2_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(643, 451);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->go);
this->Controls->Add(this->radioButton4);
this->Controls->Add(this->radioButton3);
this->Controls->Add(this->exit);
this->Controls->Add(this->radioButton2);
this->Controls->Add(this->radioButton1);
this->Name = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void radioButton1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void radioButton2_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void radioButton3_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void radioButton4_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void File_Opening(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) {
}
private: System::Void exit_Click(System::Object^ sender, System::EventArgs^ e) {
this->Close();
}
private: System::Void go_Click(System::Object^ sender, System::EventArgs^ e) {
answers = answers + 1;
if(answers == 1){
this->label1->Text = "Mikhail Gorbachev was mostly known for being what?";
this->radioButton1->Text = "The Founder of friendly's";
this->radioButton2->Text = "The inventor of roomba";
this->radioButton3->Text = "The leader of the Soviet Union";
this->radioButton4->Text = "The inventor of the diesel engine";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton3->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 2){
this->label1->Text = "How did Mikhail Gorbachev win a Nobel Peace Prize?";
this->radioButton1->Text = "Ending Cold War tensions";
this->radioButton2->Text = "Freeing East Germany";
this->radioButton3->Text = "Freeing West Germany";
this->radioButton4->Text = "Reducing nuclear weapon stockpiles";// spelling
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton1->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 3){
this->label1->Text = "Who said this quote to him 'Mr. Gorbachev tear down that wall'?";
this->radioButton1->Text = "George W. Bush";
this->radioButton2->Text = "Ronald Reagan";
this->radioButton3->Text = "Barack Obama";
this->radioButton4->Text = "George H. Bush";// spelling
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton2->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 4){
this->label1->Text = "What was Mikhail's middle name?";
this->radioButton1->Text = "Illarionovich";
this->radioButton2->Text = "Vasil'evich";
this->radioButton3->Text = "Gorbachev";
this->radioButton4->Text = "Sergeyevich";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton4->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 5){
this->label1->Text = "What was Mikhail's first job?";
this->radioButton1->Text = "Fast food worker";
this->radioButton2->Text = "Farmer";
this->radioButton3->Text = "Musician";//spelling
this->radioButton4->Text = "Coal miner";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton2->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 6){
this->label1->Text = "When did Mikhail die?";
this->radioButton1->Text = "1990";
this->radioButton2->Text = "1910";
this->radioButton3->Text = "1930";//spelling
this->radioButton4->Text = "none of the above he is still alive";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton4->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 7){
this->label1->Text = "What university did he go to?";
this->radioButton1->Text = "Moscow State University";
this->radioButton2->Text = "Yale";
this->radioButton3->Text = "Uconn";
this->radioButton4->Text = "Mendeleyev University of Chemical Technology";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton1->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 8){
this->label1->Text = "When did he become the leader of the Soviet Union ?";
this->radioButton1->Text = "1990";
this->radioButton2->Text = "2003";
this->radioButton3->Text = "1560";
this->radioButton4->Text = "1991";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton1->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 9){
this->label1->Text = "How long did he rule?";
this->radioButton1->Text = "9 year";
this->radioButton2->Text = "5 years";
this->radioButton3->Text = "6 years";
this->radioButton4->Text = "12 years";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton3->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 10){
this->label1->Text = "Gorbachev appeared in a television ad for what company?";
this->radioButton1->Text = "McDonalds";
this->radioButton2->Text = "Taco Bell";
this->radioButton3->Text = "Pizza Hut";
this->radioButton4->Text = "Olive Garden";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton3->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 11){
this->label1->Text = "What U.S. national disaster did mikhail visit?";
this->radioButton1->Text = "Hurricane Katrina";
this->radioButton2->Text = "Hurricane rita";
this->radioButton3->Text = "1993 Mississippi river flooding";
this->radioButton4->Text = "Chernobyl";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton1->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 12){
this->label1->Text = "What is his religon?";
this->radioButton1->Text = "Muslim";
this->radioButton2->Text = "Jewish";
this->radioButton3->Text = "Catholic";
this->radioButton4->Text = "Atheist";//spelling
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton4->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 13){
this->label1->Text = "When was Mikhail Gorbachev born?";
this->radioButton1->Text = "1931";
this->radioButton2->Text = "1980";
this->radioButton3->Text = "1923";
this->radioButton4->Text = "1937";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton1->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 14){
this->label1->Text = "When did Mikhail Gorbachev's wife die?";
this->radioButton1->Text = "1946";
this->radioButton2->Text = "1999";
this->radioButton3->Text = "1987";
this->radioButton4->Text = "1955";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton2->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 15){
this->label1->Text = "What town was Mikhail Gorbachev born?";
this->radioButton1->Text = "Moscow";
this->radioButton2->Text = "Alagir";
this->radioButton3->Text = "Rostiv";
this->radioButton4->Text = "Privolnoye";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton4->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 16){
this->label1->Text = "Why was the Gorbachev Foundation created?";
this->radioButton1->Text = "To provide shelter for the homeless";
this->radioButton2->Text = "Child abuse prevention";
this->radioButton3->Text = "For children with cancer";
this->radioButton4->Text = "To establish national standards for education";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton3->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 17){
this->label1->Text = "Mikhail Gorbachev grew up under the leadership of which leader?";
this->radioButton1->Text = "Adolph Hitler";
this->radioButton2->Text = "Winston Churchill";
this->radioButton3->Text = "Benito Mussolini";
this->radioButton4->Text = "Joseph Stalin";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton4->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 18){
this->label1->Text = "What did Mikhail study in college?";
this->radioButton1->Text = "Law";
this->radioButton2->Text = "Medicine";
this->radioButton3->Text = "Music";
this->radioButton4->Text = "physics";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton1->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 19){
this->label1->Text = "In addition to winning the Nobel Peace Prize what other honor(s) did he receive?";
this->radioButton1->Text = "Albert Einstein Award";
this->radioButton2->Text = "Martin Luther King Award";
this->radioButton3->Text = "Indira Gandhi Award";
this->radioButton4->Text = "All of the above";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton4->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 20){
this->label1->Text = "What is Perestroika?";
this->radioButton1->Text = "A computer game";
this->radioButton2->Text = "A play ";
this->radioButton3->Text = "Restructuring of the Soviet economy";
this->radioButton4->Text = "A Russian card game";
this->label2->Text = "you got "+ ranswers +" right so far";
if(radioButton3->Checked == true) {
ranswers = ranswers + 1;
}
}
if(answers == 21){
this->label1->Text = "Congratulations you got "+ ranswers +" out of 20";
}
}
private: System::Void label2_Click(System::Object^ sender, System::EventArgs^ e) {
; }
}
;}