0
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
             // Declare variables
             double num1, num2, num3, num4, sum;

             // Read in data
             Double::TryParse(textBox1->Text, num1);
             Double::TryParse(textBox2->Text, num2);
             Double::TryParse(textBox3->Text, num3);
             Double::TryParse(textBox4->Text, num4);

             // Process data
             sum = num1 + num2 + num3 + num4;
             sum = sum / 550 * 100 + "%";

             //Display results
             textBox5->Text = sum.ToString();
4

1 回答 1

0
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
         // Declare variables
         double num1, num2, num3, num4, sum;

         // Read in data
         Double::TryParse(textBox1->Text, num1);
         Double::TryParse(textBox2->Text, num2);
         Double::TryParse(textBox3->Text, num3);
         Double::TryParse(textBox4->Text, num4);

         // Process data
         sum = num1 + num2 + num3 + num4;
         sum = sum / 550 * 100 + "%";

         //Display results
         String^ temp = (sum.ToString() + "%"); 
         textBox5->Text = temp;
于 2013-05-07T14:58:08.983 回答