小编use*_*022的帖子

C# problems with a for loop

Can someone tell me why this doesnt work. When I enter the loop it prints everything instead of one line and get the users input. It prints Enter the integer the account numberEnter the integer the account balanceEnter the account holder lastname

Got it working thanks everyone, but now the searchaccounts doesnt work

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace ConsoleApplication1

{

class accounts

{

private int[] accountnum = new int[5]; //private accountnum array of five integer account …
Run Code Online (Sandbox Code Playgroud)

c#

1
推荐指数
1
解决办法
301
查看次数

做循环和while循环

当我输入单词"Andrea"时,程序崩溃了.我猜,但我认为这是因为我在循环内部,它不知道何时停止.如果我是对的,你能告诉我如何摆脱循环.当我休息时,它告诉我没有循环结束.

private void button1_Click(object sender, EventArgs e)
        {
             do Commission.Text = (Convert.ToDouble(textBox2.Text) / 10).ToString();
          while  (textBox1.Text == "Andrea");
        break;           
        do Commission.Text = (Convert.ToDouble(textBox2.Text) / 10).ToString();
          while (textBox1.Text == "Brittany"); 
        do Commission.Text = (Convert.ToDouble(textBox2.Text) / 10).ToString();
           while  (textBox1.Text == "Eric");
        break;          
            MessageBox.Show("The spelling of the name is incorrect", "Bad Spelling");
Run Code Online (Sandbox Code Playgroud)

c# loops

0
推荐指数
1
解决办法
580
查看次数

使用while循环时出错

while循环不起作用.当它遇到休息时退出循环时我得到一个错误.错误是没有循环语句来突破.

static void Main(string[] args)
{
    accounts myclass = new accounts();
    string userin;


    myclass.fillAccounts();
    //int i = 0;
    //while (i != 1)
    do
    {
    }
    while (userin != "x")
    {
        //use the following menu:            
        Console.WriteLine("*****************************************");
        Console.WriteLine("enter an a or A to search account numbers");
        Console.WriteLine("enter a b or B to average the accounts");
        Console.WriteLine("enter an x or X to exit program");
        Console.WriteLine("*****************************************");
        Console.Write("Enter option-->");
        userin = Console.ReadLine();
        if (userin == "a" || userin == "A")
        {
            myclass.searchAccounts();
        }
        else if …
Run Code Online (Sandbox Code Playgroud)

c# loops while-loop

0
推荐指数
2
解决办法
276
查看次数

索引(从零开始)必须大于或等于零且小于参数列表的大小

当我尝试调用余额方法时,我得到以下错误.我正在尝试列出帐户持有人的帐户余额.任何帮助都会很棒.

索引(从零开始)必须大于或等于零且小于参数列表的大小.

public void balance(){
    for (int x = 0; x < 6; ++x)
        if (x < 5){
            Console.WriteLine("Account Holders Name===>{1}Has a balance of===>{2}",
                accountname[x], accountbal[x]);
        }
}
Run Code Online (Sandbox Code Playgroud)

c#

0
推荐指数
1
解决办法
1万
查看次数

写入逗号分隔的文本文件

我很难找到如何写入逗号分隔的文本文件.我正在为自己创建一个非常基本的地址表单.我想点击button1它创建一个文本文件然后将textbox1,textbox2,textbox3和maskedtextbox1中的数据写入由逗号分隔的文件.

 public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }


    private void close_Click(object sender, EventArgs e)
    {
        Close();
    }
}

 }
Run Code Online (Sandbox Code Playgroud)

c#

0
推荐指数
1
解决办法
9332
查看次数

我想选择'20-FEB-81'和'01 -MAY-81'之间的工作

我想要雇员的姓名,工作,在'20-FEB-81'和'01 -MAY-81'之间雇用,并按升序排列

查询我跑错了

SQL> select ename, job, hiredate where hiredate between '20-FEB-81' AND '01-MAY-81'   from emp;
select ename, job, hiredate where hiredate between '20-FEB-81' AND '01-MAY-81' from emp
                        *
 ERROR at line 1:
 ORA-00923: FROM keyword not found where expected


 SQL>
Run Code Online (Sandbox Code Playgroud)

我的表SQL>从emp中选择empno,ename,job,hiredate,sal;

 EMPNO ENAME      JOB       HIREDATE         SAL
 ---------- ---------- --------- --------- ----------
  7839 KING       PRESIDENT 17-NOV-81       5000
  7698 BLAKE      MANAGER   01-MAY-81       2850
  7782 CLARK      MANAGER   09-JUN-81       2450
  7566 JONES      MANAGER   02-APR-81       2975
  7654 MARTIN     SALESMAN  28-SEP-81       1250
  7499 ALLEN      SALESMAN …
Run Code Online (Sandbox Code Playgroud)

sql oracle sqlplus

0
推荐指数
1
解决办法
2万
查看次数

选择最新的日期?

我想查询服务器列表并通过电子邮件向我发送安装更新的最后日期.

$date = (Get-HotFix | select installedon).installedon
Run Code Online (Sandbox Code Playgroud)

获取我安装更新的所有日期我只需要最后一次安装更新.我如何获得最新的日期?

powershell

0
推荐指数
1
解决办法
997
查看次数

错误检查,以便每次都不会除以10

如何查看文本框是否为空,然后仅除以该数量int.正如你现在所看到的,我每次都会除以10,所以现在我需要帮助进行错误检查.

namespace Assignment1_White
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int num1;
            int num2;
            int num3;
            int num4;
            int num5;
            int num6;
            int num7;
            int num8;
            int num9;
            int num10;
            int answer;

            num1 = int.Parse(num100.Text);
            num2 = int.Parse(num200.Text);
            num3 = int.Parse(num300.Text);
            num4 = int.Parse(num400.Text);
            num5 = int.Parse(num500.Text);
            num6 = int.Parse(num600.Text);
            num7 = int.Parse(num700.Text);
            num8 = int.Parse(num800.Text);
            num9 = int.Parse(num900.Text);
            num10 = int.Parse(num1000.Text);



            answer = (num1 …
Run Code Online (Sandbox Code Playgroud)

c#

-1
推荐指数
1
解决办法
230
查看次数

标签 统计

c# ×6

loops ×2

oracle ×1

powershell ×1

sql ×1

sqlplus ×1

while-loop ×1