do anyone know the history of programming language names? where they come from? a,b,c, java, python, scheme, prolog, ada, fortran, algol, cobol, assembly, pascal, lisp, perl, haskell, php, javascript, c#, ruby, c++ and so on. Often the name is inspired by a previous lagnuage (that's the case of C++, which derives from C, which in turn has been named after B ...), but more often language i
有谁知道编程语言名称的历史? 他们来自哪里? a,b,c,java,python,scheme,prolog,ada,fortran,algol,cobol,assembly,pascal,lisp,perl,haskell,php,javascript,c#,ruby,c ++等等。 通常这个名字的灵感来自于之前的语言(这就是C ++的例子,C源自C,而C又是以B的名字命名的),但更多的时候,语言发明者仅仅因为某种原因选择了一个他喜欢的名字。 也许你可能对编程语言的族谱感兴趣。 我会建议搜索
I have a Winforms application in c# and I want a TextBox to change language automatically when it gets focused. I tried this code: private void textBox1_Enter(object sender, EventArgs e) { SetKeyboardLayout(GetInputLanguageByName("fa")); } private void textBox1_Leave(object sender, EventArgs e) { SetKeyboardLayout(GetInputLanguageByName("eng")); } public static InputLanguage GetInputLa
我在C#中有一个Winforms应用程序,我希望TextBox在焦点时自动更改语言。 我试过这段代码: private void textBox1_Enter(object sender, EventArgs e) { SetKeyboardLayout(GetInputLanguageByName("fa")); } private void textBox1_Leave(object sender, EventArgs e) { SetKeyboardLayout(GetInputLanguageByName("eng")); } public static InputLanguage GetInputLanguageByName(string inputName) { foreach
This question already has an answer here: How to printf a 64-bit integer as hex? [duplicate] 2 answers The PRIx64 macro in <inttypes.h> is what you're looking for. It's a string token, so you can use it as: fprintf(stdout, "answer = %"PRIx64"n", val); Since you specify %llX , you probably want uppercase; use: PRIX64 您可以使用头<inttypes.h>定义的
这个问题在这里已经有了答案: 如何打印一个64位整数为十六进制? [重复] 2个答案 <inttypes.h>的PRIx64宏是您正在查找的内容。 这是一个字符串标记,所以你可以使用它: fprintf(stdout, "answer = %"PRIx64"n", val); 由于您指定了%llX ,因此您可能需要大写; 使用: PRIX64 您可以使用头<inttypes.h>定义的宏PRIx64或PRIX64 (for unsigned uppercase hexadecimal integer ) 。
This question already has an answer here: How can one print a size_t variable portably using the printf family? 12 answers C99 and C11 require a z modifier: sprintf(buf, "%zu", i); If MS Visual Studio has to be accommodated too, life is probably harder (because it doesn't adhere to either the C99 or C11 standard). According to MSDN, you need to use I instead of z .
这个问题在这里已经有了答案: 如何可以使用printf系列打印size_t变量? 12个答案 C99和C11需要z修饰符: sprintf(buf, "%zu", i); 如果MS Visual Studio也必须兼容,生活可能更难(因为它不符合C99或C11标准)。 根据MSDN,您需要使用I而不是z 。
C99 standard has integer types with bytes size like int64_t. I am using the following code: #include <stdio.h> #include <stdint.h> int64_t my_int = 999999999999999999; printf("This is my_int: %I64dn", my_int); and I get this compiler warning: warning: format ‘%I64d’ expects type ‘int’, but argument 2 has type ‘int64_t’ I tried with: printf("This is my_int: %lldn", my_int); // lo
C99标准具有像int64_t字节大小的整数类型。 我正在使用下面的代码: #include <stdio.h> #include <stdint.h> int64_t my_int = 999999999999999999; printf("This is my_int: %I64dn", my_int); 我得到这个编译器警告: warning: format ‘%I64d’ expects type ‘int’, but argument 2 has type ‘int64_t’ 我试着用: printf("This is my_int: %lldn", my_int); // long long decimal 但我得到同样的警告。
I am trying to compile the below on RHEL 5.6 , 64 bit, and i keep getting a warning "var.c:7: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'" Here is my code: #include <stdio.h> #include <stdlib.h> int main() { unsigned int n =10; printf("The size of integer is %dn", sizeof(n)); } It does not matter
我正在尝试在RHEL 5.6,64位上编译以下代码,并且我不断收到警告 “var.c:7:warning:format'%d'expect type'int',but argument 2 has type'long unsigned int'” 这是我的代码: #include <stdio.h> #include <stdlib.h> int main() { unsigned int n =10; printf("The size of integer is %dn", sizeof(n)); } 如果我将“n”的声明更改为以下内容无关紧要 有符号整数n =
I can print with printf as a hex or octal number. Is there a format tag to print as binary, or arbitrary base? I am running gcc. printf("%d %x %on", 10, 10, 10); //prints "10 A 12n" print("%bn", 10); // prints "%bn" Hacky but works for me: #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" #define BYTE_TO_BINARY(byte) (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (b
我可以使用printf作为十六进制或八进制数进行打印。 是否有格式标签打印为二进制或任意的基地? 我正在运行gcc。 printf("%d %x %on", 10, 10, 10); //prints "10 A 12n" print("%bn", 10); // prints "%bn" 哈克,但为我工作: #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" #define BYTE_TO_BINARY(byte) (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'),
I want to print out a variable of type size_t in C but it appears that size_t is aliased to different variable types on different architectures. For example, on one machine (64-bit) the following code does not throw any warnings: size_t size = 1; printf("the size is %ld", size); but on my other machine (32-bit) the above code produces the following warning message: warning: format '%ld
我想用C打印出一个size_t类型的变量,但是看起来size_t在别的体系结构上被别名为不同的变量类型。 例如,在一台机器上(64位),以下代码不会引发任何警告: size_t size = 1; printf("the size is %ld", size); 但在我的其他机器上(32位),上面的代码会产生以下警告消息: 警告:格式'%ld'需要类型'long int *',但参数3的类型为'size_t *' 我怀疑这是由于指针大小的差异造成的,所以在我的6
This question already has an answer here: scanf() leaves the new line char in the buffer 2 answers why only when i do space in "%d " --> scanf("%d ", &num); it works? scanf("%d", &num); without a space after the "%d" , stops scanning after reading a number. So with input 123Enter, the 'n' remains in stdin for the next input functi
这个问题在这里已经有了答案: scanf()离开缓冲区2中的新行char 为什么只有当我在“%d” - > scanf(“%d”,#)中执行空格时; 有用? scanf("%d", &num); "%d"后没有空格,读取一个数字后停止扫描。 因此,对于输入123Enter, 'n'保留在stdin以用于下一个输入函数,如现在的非标准gets() 。 gets()读取单个'n'并返回。 通过添加一个空格, scanf("%d ", &
This question already has an answer here: Why inside a loop, scanf() with %d does not wait for the user input in case it received an invalid input previously? 1 answer If scanf fails to preform the requested conversion, it will leave the input stream unchanged. So while your check is correct, you need to clean the input stream of the erroneous input before re-attempting to read a number aga
这个问题在这里已经有了答案: 为什么在一个循环中,scanf()与%d不会等待用户输入以防事先收到无效输入? 1个答案 如果scanf未能预先执行请求的转换,则会使输入流保持不变。 所以,当你的检查是正确的,你需要清除错误输入的输入流,然后重新尝试再次读取一个数字。 你可以用scanf本身和输入抑制修饰符来做到这一点: float num1; while (scanf("%f",&num1)==0) { printf("Invalid input. Please enter a numb