0

所以我刚开始在大学学习处理,但遗憾的是错过了前几节课,所以我手头有课本,我正在尝试自己学习这个,有人可以告诉我这是对还是错?你会救我的命。有点..谢谢:D

这是问题:

编写一个程序,用它们的值声明和初始化以下变量。向您的程序添加注释以分隔不同的小节。一世。noOfstudents =50 ii. 考试成绩 = -50
iii. priceOfShoes = 59.99 iv。收入 = 10,750.99 v. greetingMessage='你好' vi. 字母 = 'A'

vii lossOfIncome = -20.30
viii sum=0.0000000000076

这是我为这个问题输入的代码;

void setup() {
int noOfStudents;
noOfStudents = 50; //Number of Students
float examMark;
examMark = -50; // Exam Mark
float shoePrice;
shoePrice = 59.99; // The price of the shoes
double income;
income = 10750.99; // The income
print ("hello world"); //displays hello world
char message;
message = 'A'; //displays the character A

float lossOfIncome = -20.30;
double lossOfIncome2 = 0.0000000000076; //The loss of income

}
4

1 回答 1

0

您可以在一行上声明和初始化变量,即int noOfStudents = 50;. 另外,您正在使用该print()方法。您更有可能想要使用String变量类型。

您可能还想看看Ch。Daniel Shiffman 的《学习处理》一书的第 4 章,或者至少是第 4 章的示例。4在线。

http://www.learningprocessing.com/examples/

于 2012-10-24T00:46:02.467 回答