我的C#程序有问题:我创建了一个包含10个问题和10个图像的测验.我得到这个Length cannot be less than zero.\r\nParameter name: length
在线路
int imageIndex = int.Parse(line.Substring(0, delimiter));
Run Code Online (Sandbox Code Playgroud)
即使在我的记事本文件中,我也包含了图像索引:
3:What is the foo in the bar?
10:How can you add a widget?
4:Why pick a bar over a foo?
Run Code Online (Sandbox Code Playgroud)
这是代码:
if (nr >= questions.Count)
{
button1.Enabled = false;
}
else
{
Random r = new Random();
int x;
do
{
x = r.Next(questions.Count);
}
while (questions[x].displayed == true);
textBox1.Text = questionText;
radioButton1.Text = questions[x].answer1;
radioButton2.Text = questions[x].answer2;
questions[x].displayed= true;
current_question = x;
}
Run Code Online (Sandbox Code Playgroud) 我有一个命令,log(0.25)
但计算器输出是-0.6
和Perl输出-1.3
.
为什么以及如何使用它?
以下代码中的解决方案是什么
Class A{}
void func(){}
printf("%d,%d",sizeof(A),sizeof(func));
Run Code Online (Sandbox Code Playgroud) for (String key : output.keySet())
{
// some code
}
Run Code Online (Sandbox Code Playgroud)
输出是hashmap的一个对象,我想遍历所有值的hashmap.我在互联网上找到了一个代表循环的例子......但是当我尝试执行它时,Eclipse不允许我这样做.请告诉我一个有效的方法或解释这个循环.这样我就可以遍历地图了.
我的函数伪有点像这样
public void function (String key)
{
Set<String> keys = output.keySet();
// now I have to iterate through the keySet and match 'key' with the keys from keySet
}
Run Code Online (Sandbox Code Playgroud) 有没有办法创建某种类型的For循环来用空格分隔字符串?到目前为止,我可以显示一个字符串并查找它有多少个字符.
import java.util.Scanner;
import java.lang.String;
public class Word{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
int b;
String word;
System.out.println ("Enter a word: ");
word = scan.next();
b = word.length();
System.out.println (word);
System.out.println (b);
}
}
Run Code Online (Sandbox Code Playgroud) 当我单击页面中的"保存"按钮时,它会执行此操作
protected void btnsave_Click(object sender, EventArgs e)
Run Code Online (Sandbox Code Playgroud)
然后它调用save()
函数.在save()
函数中,它调用存储过程insertcustrec5.一旦到达存储过程insertcustrec5,就会引发错误
"过程或函数'insertcustrec5'需要参数'@ tb1',这是未提供的"
但我提供..ni检查每个参数得到它的值仍然这个错误继续发生.
- >我的存储过程是:
ALTER procedure [dbo].[insertcustrec5]
(
@RID int,
@Remarks varchar(MAX),
@CRDate date,
@ChallanNo float,
@Quantity float,
@tb1 int,
@Amount float
)
As
INSERT INTO Customer_Receive(ChallanNo, CRDate, RID, Quantity, Remarks,CustID,Amount)
VALUES (@ChallanNo,@CRDate,@RID,@Quantity,@Remarks,@tb1,@Amount)
Run Code Online (Sandbox Code Playgroud)
- >保存调用存储过程的函数是:
public void save()
{
data.AddParameter("RID", this.rid);
data.AddParameter("CustID", this.tb1);
data.AddParameter("Remarks", this.remarks);
data.AddParameter("CRDate", this.CRDate);
data.AddParameter("ChallanNo", this.ChallanNo);
data.AddParameter("Quantity", this.quantity);
data.ExecuteNonQuery("insertcustrec5");
Run Code Online (Sandbox Code Playgroud)
- > ExecuteNonQuerry功能: -
public int ExecuteNonQuery(string commandText)
{
try
{
SqlCommand command = new …
Run Code Online (Sandbox Code Playgroud) <?php
function zz(& $x)
{
$x=$x+5;
}
$x=10;
zz($x);
echo $x;
Run Code Online (Sandbox Code Playgroud)
我使用了上面的代码,但我不知道&
符号的含义.
试图建立一个非常基本的石头剪刀代码,但添加功能后它似乎不起作用,谁能告诉我,为什么?
print "1 stands for paper, 2 stands for rock, 3 stand for scissors"
signs = [1, 2, 3]
gaming = 1
def game():
from random import choice
pc = raw_input("pick a sign, use the numbers shown above ")
i = int(pc)
cc = choice(signs)
if i - cc == 0 : # 3 values
print "it's a draw"
elif i - cc == 1 : # 2 values
print "you lose"
elif i - cc == 2 : # …
Run Code Online (Sandbox Code Playgroud) 我想标准化R中的数据(平均零和标准差1.0),我使用scale()
函数.我的所有数字都大于零.但是当我将它们标准化时,我仍然有数字; 100,......更奇怪的是,当我绘制密度时,我的密度也为负值!!
这是我的数据的子集:
Tr[1:10,]
[1] 1.287161e+01 1.300534e+00 1.140467e+00 7.958636e-01 4.886365e-01
data<-scale(Tr)
Run Code Online (Sandbox Code Playgroud)
有人会帮我解决这个问题吗?
map[0][4]='\0';
city1[0][4]='\0';
strcpy(map[0],city1[0]);
map[0][0]='z';
printf("%s",map[0]);
printf("%s",city1[0]);
printf("%d \n",strcmp(map[0],city1[0]));
Run Code Online (Sandbox Code Playgroud)
这个函数的输出是 zail
nail
12
为什么会这样?我不明白的是strcmp
什么?为什么12而不是任何其他数字?
我有一个类似下面的场景,在图标(十字符号)之前和之后显示间隔(线),而不是在按钮之前和之后显示间隔(线)(带取消文本).我怎样才能做到这一点......
我的Css文件是
.Container > *:first-child::before,
.Container > *::after
{
display: inline-block;
content: url('../Content/Images/Line.png');
}
Run Code Online (Sandbox Code Playgroud)
我的所有图标,按钮(带取消文本)都在容器div中
我们可以限制按钮前后的显示行(使用取消文本)吗?
我尝试了下面的代码,但没有用.
.Container > *:not(input[type="button"]):first-child::before,
.Container > *:not(input[type="button"])::after
{
display: inline-block;
content: url('../Content/Images/Line.png');
}
Run Code Online (Sandbox Code Playgroud)