U
CCodes
这个作者很懒,什么都没留下…
展开
-
ungetch.c
#include #include #include void main(void) { int letter; int done = 0; int uppercase_found = 0; do { letter = getch(); if (islower(letter)) putchar(letter); else原创 2007-11-08 23:27:00 · 416 阅读 · 0 评论 -
use_swap.c
#include void swap_values(int *, int *);void main(void) { int a = 1, b = 2; printf("Original values a %d b %d/n", a, b); swap_values(&a, &b); printf("Swapped values a %d b %d/n", a,原创 2007-11-08 23:57:00 · 633 阅读 · 0 评论 -
umask.c
#include #include #include #include #include void main(void) { int output; int old_setting; old_setting = umask(S_IWRITE); if ((output = creat("OUTPUT.DAT", S_IWRITE)) == -1) {原创 2007-11-08 23:26:00 · 394 阅读 · 0 评论 -
unlink.c
#include void main(int argc, char *argv[]) { while (*++argv) if (unlink(*argv)) printf("Error removing %s/n", *argv); }原创 2007-11-08 23:50:00 · 401 阅读 · 0 评论 -
usedelay.c
#include #include void main(void) { printf("About to delay 5 seconds/n"); delay(5000); printf("Done/n"); }原创 2007-11-08 23:52:00 · 419 阅读 · 0 评论 -
useparam.c
#include void hello_world(void) { printf("Hello, world!/n"); }void hello_count(int message_count) { int counter; for (counter = 1; counter hello_world(); }void main(void) { prin原创 2007-11-08 23:52:00 · 454 阅读 · 0 评论 -
useproto.c
#include int i_cube(int);float f_cube(float);void main(void) { printf("The cube of 3 is %d/n", i_cube(3)); printf("The cube of 3.7 is %f/n", f_cube(3.7)); }int i_cube(int value) { return原创 2007-11-08 23:53:00 · 346 阅读 · 0 评论 -
u_intout.c
#include void main(void) { unsigned int value = 42000; printf("Displaying 42000 as unsigned %u/n", value); printf("Displaying 42000 as int %d/n", value); }原创 2007-11-08 23:58:00 · 496 阅读 · 0 评论 -
useaddr.c
#include void main(void) { int a = 1, b = 2; int *i_pointer; // Assign an address i_pointer = &a; // Change the value pointed to by i_pointer to 5 *i_pointer = 5; // Display原创 2007-11-08 23:51:00 · 324 阅读 · 0 评论 -
use_both.cpp
#include #include void main(void) { cout printf("C/C++ Programmers "); cout }原创 2007-11-08 23:53:00 · 433 阅读 · 0 评论 -
use_ind.c
#include void main(void) { int age = 10; int user_has_dog = 0; // 0 is false if (age == 10) { printf("Dogs are important pets/n"); if (! user_has_dog) printf("Yo原创 2007-11-08 23:55:00 · 514 阅读 · 0 评论 -
use_iter.cpp
// If you use Visual C++, set the compile options to /GX#ifdef __BCPLUSPLUS__#include #include #else#include #include #endifusing namespace std;typedef list LISTINT;void main(void) { LISTIN原创 2007-11-08 23:55:00 · 519 阅读 · 0 评论 -
use_link.cpp
#include #include #include class dblinkob { public: char info; dblinkob *next; dblinkob *previous; dblinkob() { info = 0; next = NULL; previous = NULL; } dblinkob *getn原创 2007-11-08 23:55:00 · 787 阅读 · 0 评论 -
use_sbuf.cpp
// Operations with streambufs.#include #include void main(void) { int c; const char *filename = "_junk_.$$$"; ofstream outfile; streambuf *out, *input = cin.rdbuf(); // Position at the原创 2007-11-08 23:56:00 · 504 阅读 · 0 评论 -
use_str.cpp
#include #include #include #include #include class Strings { char *p; int size; public: Strings(char *str); Strings(void); Strings(const Strings &obj); // Copy constructor ~S原创 2007-11-08 23:57:00 · 423 阅读 · 0 评论 -
use_mem.cpp
#include void main(void) { cout.setf(ios::hex); cout cout.unsetf(ios::hex); cout.fill(?); cout.width(10); cout }原创 2007-11-08 23:56:00 · 449 阅读 · 0 评论 -
unionsiz.c
#include void main(void) { union EmployeeDates { int days_worked; struct Date { int month; int day; int year; } last_day; } emp_info; union Numbers {原创 2007-11-08 23:49:00 · 368 阅读 · 0 评论 -
unsetf.cpp
#include void main(void) { cout.setf(ios::uppercase | ios::scientific); cout cout.unsetf(ios::uppercase); cout }原创 2007-11-08 23:50:00 · 549 阅读 · 0 评论 -
un_class.cpp
#include union swap_byte { void swap(void); void set_byte(unsigned i); void show_word(void); unsigned u; unsigned char c[2]; };void swap_byte::swap() { unsigned char t; t = c[0];原创 2007-11-08 23:50:00 · 515 阅读 · 0 评论 -
upper.c
#include #include void main(void) { char line[255]; // Line of text read while (fgets(line, sizeof(line), stdin)) fputs(strupr(line), stdout); }原创 2007-11-08 23:51:00 · 363 阅读 · 0 评论 -
uppererr.c
#include void Main(void) { printf ("This program does not compile."); }原创 2007-11-08 23:51:00 · 429 阅读 · 0 评论 -
usebreak.c
#include void main(void) { int counter; for (counter = 1; counter { if (counter == 50) break; printf("%d ", counter); } printf("/nNext loop/n"); for (counte原创 2007-11-08 23:51:00 · 362 阅读 · 0 评论 -
useparam.cpp
#include void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; }void swap(int *a, int *b, int *c, int *d) { int temp = *a; *a = *b; *b = temp; temp = *c; *c = *d; *d =原创 2007-11-08 23:52:00 · 359 阅读 · 0 评论 -
use_cerr.cpp
#include void main(void) { int i; for (i = 1; i cerr }原创 2007-11-08 23:53:00 · 535 阅读 · 0 评论 -
use_cin.cpp
#include void main(void) { int age; float salary; char name[128]; cout cin >> name >> age >> salary; cout }原创 2007-11-08 23:54:00 · 409 阅读 · 0 评论 -
use_func.c
#include void hello_world(void) { printf("Hello, world!/n"); }void main(void) { hello_world(); }原创 2007-11-08 23:54:00 · 450 阅读 · 0 评论 -
use_glink.cpp
#include #include #include template class dblinkob { public: DataT info; dblinkob *next; dblinkob *previous; dblinkob() { info = 0; next = NULL; previous = NULL; } dbl原创 2007-11-08 23:54:00 · 548 阅读 · 0 评论 -
use_man.cpp
#include #include void main(void) { cout cout }原创 2007-11-08 23:56:00 · 403 阅读 · 0 评论 -
use_max.c
#include int get_maximum(int, int);void main(void) { int result; result = get_maximum(100, 200); printf("The larger value is %d/n", result); }原创 2007-11-08 23:56:00 · 465 阅读 · 0 评论 -
utime.c
#include #include void main(int argc, char **argv) { if (utime(argv[1], (struct utimbuf *) NULL)) printf("Error setting date and time/n"); else printf("Date and time stamp set/n"); }原创 2007-11-08 23:58:00 · 526 阅读 · 0 评论