所以我很好奇是否有一个简短的声明:
if(number < 0 )
bigInt.sign = 0;
else
bigInt.sign = 1;
Run Code Online (Sandbox Code Playgroud)
如果a <b等,我会看到所有这些简短陈述.
我不确定如何正确地做到这一点,并希望得到一些意见.
谢谢!
我实际上只是在你们回答之前弄明白了.
我正在使用 bigInt.sign = (number < 0) ? 1 : 0
我有一个包含大量重复量的数据库,每有一个独特的ID,但它们的PermitID和EncID是相同的.我需要删除数据库中除最高ID之外的所有ID.
sql语句,
DELETE FROM tblInvoices
WHERE EncID = '0237' AND PermitID IN (
SELECT Max(ID) FROM tblInvoices Group BY PermitID)
Run Code Online (Sandbox Code Playgroud)
删除所有记录.我试过了
DELETE FROM tblInvoices
WHERE EncID = '0237' AND PermitID
< (SELECT Max(ID) FROM tblInvoices Group BY PermitID)
Run Code Online (Sandbox Code Playgroud)
但我收到错误
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
数据的一个例子是
ID PermitID EncID
1 …Run Code Online (Sandbox Code Playgroud) 我遇到的问题是我的功能似乎只返回一个.我以为我正确地返回了这些功能,但似乎我不是.
char goAgain()
{
char ch;
do
{
printf("Would you like to go again? ");
ch = getchar();
while(fgetc(stdin) != '\n');
}while(ch != 'n' || 'y');
return ch;
}
double findMedian(int array[], int length)
{
int mid;
double median, medianLeft, medianRight;
if(length % 2 == 0)
{
mid = length / 2;
// medianLeft = array[mid];
// medianRight = array[mid + 1];
}
else
{
mid = length / 2;
median = array[mid];
}
return median;
}
Run Code Online (Sandbox Code Playgroud)
这就是我调用中位数的方式
double mean …Run Code Online (Sandbox Code Playgroud) 我的菜单有问题.我从用户那里得到一个号码,但每当我得到一个号码时,无论我做什么,它都只做一个选项.我究竟做错了什么?
int main()
{
int array[SIZE];
int size = readNum();
fillArray(array, size);
char option = 'y';
do
{
int num = menu();
if(num == 1)
fillArray(array, size);
else if(num == 2)
{
int newSize = readNum();
fillArray(array, newSize);
}
else
{
sortArray(array);
}
}while(option == 'y');
return 0;
}//end main
int menu()
{
printf("1)Change the values of the array\n2)Change the size of the array and the values in the array\n3)Find and display the mean and median\nChoice: ");
int menuChoice = …Run Code Online (Sandbox Code Playgroud)