按照这里的标志列表进行操作,顶部的行是关于用法:Usage: mysql [OPTIONS] [database]
.
我正在运行Windows 8; 我的桌子是"联系"; 我想source C:/myfile.sql
用verbose选项创建一个tee文件.
我已经试过mysql -v contact
,-v contact
,--verbose contact
,--verbose source C:/myfile.sql
,和各种人.
最初我使用了switch/case,但条件必须是变量匹配的常量值,而变量是否在范围内的布尔值.
相反,我有这种怪异:
if ( data[y] > 91 ) {
grades[9] = grades[9] + 1;
}
else if ( data[y] > 88 && data[y] < 92 ) {
grades[8] = grades[8] + 1;
}
else if ( data[y] > 84 && data[y] < 89 ) {
grades[7] = grades[7] + 1;
}
else if ( data[y] > 81 && data[y] < 85) {
grades[6] = grades[6] + 1;
}
else if ( data[y] > 79 && data[y] < 82) {
grades[5] …
Run Code Online (Sandbox Code Playgroud) 对于这项任务,我的教授给了我们以下函数头:
void thisFunc(Node** root, const int * elements[], const int count)
Run Code Online (Sandbox Code Playgroud)
据推测,这是正确的,我无法改变这一点.
Const int*elements是一个使用scanf获取的int值数组; 我和我一起宣布了
int entries[atoi(argv[1])-1];
Run Code Online (Sandbox Code Playgroud)
并成功填充它
for(int a=0; a < atoi(argv[1]); a++) {
scanf("%i", &entries[a]);
}
Run Code Online (Sandbox Code Playgroud)
但我正在努力调用thisFunc.
thisFunc(&bst, entries, atoi(argv[1]));
Run Code Online (Sandbox Code Playgroud)
这引发了明显的错误:
note: expected 'const int **' but argument is of type 'int *'
Run Code Online (Sandbox Code Playgroud)
如果我是对的,它期待一个指向int的指针的常量数组?我应该如何处理将使其成为有效参数的条目数组?
我已经尝试通过引用(和条目)传入条目,但我有点迷失.
它编译,但它不会从.o文件链接到可执行文件.我已经取出了我现在和它运作良好的一切(基本上,str_to_int中的所有内容).
我的代码:
#include <stdio.h>
#include <stdlib.h>
int str_to_int( char string[] ) {
// takes null-terminate ascii string, returns int value
// value of digit at i = (value*10)+(str[i]-'0').
int num=0;
int sign=0;
return num;
}
int main( int argc, char* argv[] ) {
if (argc==1) {
printf( "usage: review_grades score1 [score2 ...]\n" );
printf( "note: score values are non-negative.\n" );
}
else {
printf( "population: %u \n", argc-1 ); // population
printf( "%u \n", str_to_int(argv[1]));
}
return EXIT_SUCCESS ;
} …
Run Code Online (Sandbox Code Playgroud)