// chapter 01
/*
#include <stdio.h>
int main(void)
{
int dogs;
printf("How many dogs do you have?\n");
scanf("%d", &dogs);
printf("So you have %d dog(s)!\n", dogs);
return 0;
}
*/
carbondioxide////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// chapter 02
// fathm_ft.c -- converts 2 fathoms to feet
/*
#include <stdio.h>
int main(void)
{
int feet, fathoms;
fathoms = 2;
feet = 6 * fathoms;
printf("There are %d feet in %d fathoms!\n", feet, fathoms); printf("Yes, I said %d feet!\n", 6 * fathoms);
return 0;
}
可望不可即
*/
//////////////////////////////////////////////////////////////////
/*
#include <stdio.h>
int main(void) // a simple program
初中英语听力练习{
int num; // define a variable called num
num = 1; // assign a value to num
printf("I am a simple "); // u the printf() function printf("computer.\n");
printf("My favorite number is %d becau it is first.\n",num); return 0;
}*/
//////////////////////////////////////////////////////////////////
// two_func.c -- a program using two functions in one file
/* #include <stdio.h>
功夫熊猫英文字幕void butler(void); // ISO/ANSI C function prototyping
int main(void)
{
printf("I will summon the butler function.\n"); butler();
printf("Yes. Bring me some tea and writeable CD-ROMS.\n"); return 0;
}
void butler(void) // start of function definition
{
printf("You rang, sir?\n");
indicate}
*/
//////////////////////////////////////////////////////////////////
/
/////////////////////////////////////////////////////////////////
// chapter 03 数据和 C
/*
// altnames.c -- portable names for integer types
#include <stdio.h>
the
#include <inttypes.h> // supports portable types the system doesn't contain header fileint main(void)
{
int16_t me16; // me16 a 16-bit signed variable
me16 = 4593;
printf("First, assume int16_t is short: ");
printf("me16 = %hd\n", me16);
printf("Next, let's not make any assumptions.\n"); printf("Instead, u a \"macro\" from inttypes.h: ");
printf("me16 = %" PRId16 "\n", me16);
return 0;
}
*/
//////////////////////////////////////////////////////////////////
/*
// bas.c--prints 100 in decimal, octal, and hex
#include <stdio.h>
int main(void)
{
int x = 100;
printf("dec = %d; octal = %o; hex = %x\n", x, x, x);
printf("dec = %d; octal = %#o; hex = %#x\n", x, x, x);
//%# 十六进制前显示 Ox // 八进制数前显示 o
return 0;
}
*/
/
/////////////////////////////////////////////////////////////
/*
// charcode.c-displays code number for a character
#include <stdio.h>
int main(void)
{
char ch;
printf("Plea enter a character.\n");
scanf("%c", &ch);
look it up
printf("The code for %c is %d.\n", ch, ch);
return 0;
}
*/
//////////////////////////////////////////////////////////////
/*
//print1.c-displays some properties of printf()
#include <stdio.h>
int main(void)
{
int ten = 10;
int two = 2;
printf("Doing it right: ");
printf("%d minus %d is %d\n", ten, 2, ten - two );
printf("Doing it wrong: ");
printf("%d minus %d is %d\n", ten ); // forgot 2 arguments
return 0;
}
*/
//////////////////////////////////////////////////////////////
/* print2.c-more printf() properties */
/*
#include <stdio.h>
int main(void)
{
unsigned int un = 00; // system with 32-bit int
short end = 200; // and 16-bit short
long big = 65537;
long verybig = 908642;
//C 也可以使用前缀 h 来表示 short 类型。
// 因此 %hd 显示一个十进制的 short 整型。 %ho 为八进制形式。 printf("un = %u and not %d\n", un, un);
printf("end = %hd and %d\n", end, end);
printf("big = %ld and not %hd\n", big, big);
printf("verybig= %lld and not %ld\n", verybig, verybig);
return 0;
}
*/
//////////////////////////////////////////////////////////////
/* showf_pt.c -- displays float value in two ways */
capital one/*
#include <stdio.h>
int main(void)
{
float aboat = 32000.0;
double abet = 2.14e9;
long double dip = 5.32e-5;
printf("%f can be written %e\n", aboat, aboat);
printf("%f can be written %e\n", abet, abet);
printf("%f can be written %e\n", dip, dip);
return 0;
}
*/
//////////////////////////////////////////////////////////////
/* toobig.c-exceeds maximum int size on our system */
/*
#include <stdio.h>
int main(void)
{
int i = 47;
video是什么意思
unsigned int j = 95;
printf("%d %d %d\n", i, i+1, i+2);
国庆节快乐的英文printf("%u %u %u\n", j, j+1, j+2);
return 0;
好烦}
*/
//////////////////////////////////////////////////////////////