我正在创建一个将十六进制数转换为十进制数的程序。这是代码:
program hexadesimal;
uses crt;
var
d, j, l, pow, y:integer;
x:longint;
h:string;
label z;
begin
z:
readln(h);
d:=0;
l:=length(h);
for j:=1 to length(h) do
begin
if (h[j] = 'A') then h[j] = '10';
if (h[j] = 'B') then h[j] = '11';
if (h[j] = 'C') then h[j] = '12';
if (h[j] = 'D') then h[j] = '13';
if (h[j] = 'E') then h[j] = '14';
if (h[j] = 'F') then h[j] = '15';
l:=l - 1;
pow := power(16, l);
val(h[j], x, y);
d := d + (x * pow);
end;
writeln(d);
readln;
end.
然而,当我编译时,错误出现了非法表达,它指向这些行:
if (h[j] = 'A') then h[j] = '10';
if (h[j] = 'B') then h[j] = '11';
if (h[j] = 'C') then h[j] = '12';
if (h[j] = 'D') then h[j] = '13';
if (h[j] = 'E') then h[j] = '14';
if (h[j] = 'F') then h[j] = '15';
我该怎么办?
答案 0 :(得分:0)
print("\n Printing all forms on page...\n")
for form in br.forms():
print("Form Name:", form.name)
print form
print("\n Done printing forms...\n")
行没有意义。 var mongoose = require('mongoose');
var courseSchema = require('./video-course-events');
module.exports.saveEvent = function(req, res){
var courseTitle = req.body.CourseDetails.courseTitle;
var Vcevents = mongoose.model(courseTitle, courseSchema);
var vcevents = new Vcevents(req.body);
Vcevents.find(function (err, result){
if(result.length)
{
// replace the collection(eg, mycourse) with new using same name(ie, mycourse).
}
else if(err){
console.log('Error occured..!!', err);
}
else{
vcevents.save(function (err, results){
if(err){
res.json(err);
}
else{
res.json(results);
}
});
}
});
}
指的是字符串中的字符,因此它不能等于字符串(包含2或mor字符),如' 10'。如果您希望将值分配给变量,则需要使用$sql = " AND ticket_groupid IN (
SELECT tg FROM t as tt
NATURAL JOIN tr NATURAL JOIN m
WHERE tt.tickettime BETWEEN '$dateFrom' AND '$dateTo' AND tt.bsid = $bsid
AND 'LOST' IN (
SELECT GROUP_CONCAT(tr.ticketstatus)
FROM tr NATURAL JOIN m as mm
WHERE mm.ticket_groupid = m.ticket_groupid
)
GROUP BY mm.ticket_groupid )"
运算符。 if (h[j] = 'A') then h[j] = '10';
不是一个赋值,而是一个比较运算符,在您的情况下会导致h[j]
。换句话说,您将获得以下结构::=