我知道这可能是非常基本的,我用谷歌搜索并完成了搜索,但我遇到的问题是一个非常基本的if/else场景.第一个语句产生结果,这告诉我,我以某种方式弄乱了其他语句.这让我有点疯狂.仅供参考,这是我第一次使用表单窗口.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Wk2_Part1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int season;
int job;
season = Convert.ToInt32(textBox1.Text);
job = Convert.ToInt32(textBox2.Text);
if (season == 1)
if (job == 1)
label3.Text = "There is a 20% discount on the exterior job";
else
if (season == 2)
if (job == 1)
label3.Text …Run Code Online (Sandbox Code Playgroud) 我是COBOL的新手,想写一个嵌套的if语句.我在ELSE-IF和ELSE上遇到错误.我确定这是一个简单的修复,但我无法弄清楚我哪里出错了.
reading-procedure.
display "Enter Type of Pet: " with no advancing.
accept pet.
display "Enter Appointment Fee: " with no advancing.
accept fee.
IF pet = 'dog'
add fee total giving dogTotal.
add 1 to dogCount.
ELSE-IF pet = 'cat'
add fee total giving catTotal.
add 1 to catCount.
ELSE
add fee total giving otherTotal.
add 1 to otherCount.
END-IF
Run Code Online (Sandbox Code Playgroud)