c/c++语言中的字符集和字符编码
在c语言中,hello world程序的编码其实未必就只有那一种书写格式,有些格式看起来有点乱码,却依然有着能正常编译,运行的良好品性,真是难能可贵,其中的秘密,看一看c语言中字符集和字符编码的描述吧。
??= include<stdio.h>
int main( int argc, char* argv??(??))
<%
if( argc > 1 )
printf( "Hello, %s!??/a??/n", argv<:1:>);
return 0;
%>
c语言中,源字符集和执行字符集都有基本字符集和扩展字符,为了是程序都能顺利编译运行,最好都用基本字符集中的字符。ISO/IEC 646标准允许把本国额外需要的字符安排到原先ASCII中"[", "]", "{", "}" 等占据的位置。为了将这些非标准内容有更好的可读性,c标准委员会有用“三联符序列” 表示缺少的字符。
三联符序列如下:
??= (#) ??) (]) ??( ([)
??! (|) ??/(\) ??- (~)
??> (}) ??<({) ??' (^)
而在c++中,又引入了替换标记
替换记号:
<%({) %>(}) <:([) :>(]) %:(#) %:%:(##)
and(&&) bitor(|) or(||) xor(^) compl(~) bitand(&)
and_eq(
相关文档:
源码:
# include <stdio.h>
int main()
{
/* 定义了一个无符号字符型变量,此变量只能用来存储无符号数 */
unsigned char result;
int a, b, c, d;
a = 2;
b = 4; ......
源码:
# include <stdio.h>
int main()
{
/* 定义一个整形指针p */
int *p;
int begin, end;
begin = 10;
/* 给指针p赋初值 */
p = &begin;
& ......
源码:
# include <stdio.h>
int main()
{
int x, y, num1, num2, temp;
printf("请输入两个正整数:\n");
scanf("%d %d", &num1, &num2);
if(num1 < num2)
......
C Sharp(C#)中如何删除文件(文件夹)
直接删除:
using System.IO;
...
string filePath = @"D:\...\xxx.xxx";
if (File.Exists(filePath))
{
File.Delete(filePath);
}
else
{
Console. ......
书中有几个问题有点模糊。记录一下。
Answer to Exercise 1-7
Write a program to print the value of EOF .
#include <stdio.h>
int main(void)
{
printf("The value of EOF is %d\n\n", EOF);
return 0 ......