91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 14.11MB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發布日期: 2023-07-02
  • 語言: 其他
  • 標簽: cs50??問題集??源碼??

資源簡介

哈佛大學公開課cs50 http://download.csdn.net/detail/cheng5129540/3763638#comment這里有問題集,建議從這里下載,但是沒有源碼,所以找了源碼。 這里面3,4,5有2種版本,5,7,8只有普通的,而1,2的問題集是沒源碼的。 所有都可以從這下載的:http://cs50.tv/2010/fall/#l=psets&r=about&v=lectures/0/week0w

資源截圖

代碼片段和文件信息

/***************************************************************************
?*?fifteen.c
?*
?*?Computer?Science?50
?*?Problem?Set?3
?*
?*?Implements?The?Game?of?Fifteen?(generalized?to?d?x?d).
?*
?*?Usage:?fifteen?d
?*
?*?whereby?the?board‘s?dimensions?are?to?be?d?x?d
?*?where?d?must?be?in?[DIM_MINDIM_MAX]
?*
?*?Note?that?usleep?is?obsolete?but?it?offers?more?granularity?than
?*?sleep?and?is?simpler?to?use?than?nanosleep;?‘man?usleep‘?for?more.
?***************************************************************************/
?
#define?_XOPEN_SOURCE?500

#include?
#include?
#include?
#include?


//?constants
#define?DIM_MIN?3
#define?DIM_MAX?9


//?board
int?board[DIM_MAX][DIM_MAX];

//?dimensions
int?d;


//?prototypes
void?clear(void);
void?greet(void);
void?init(void);
void?draw(void);
bool?move(int?tile);
bool?won(void);


int
main(int?argc?char?*argv[])
{
????//?greet?user?with?instructions
????greet();

????//?ensure?proper?usage
????if?(argc?!=?2)
????{
????????printf(“Usage:?%s?d\n“?argv[0]);
????????return?1;
????}

????//?ensure?valid?dimensions
????d?=?atoi(argv[1]);
????if?(d??DIM_MAX)
????{
????????printf(“Board?must?be?between?%d?x?%d?and?%d?x?%d?inclusive.\n“
?????????DIM_MIN?DIM_MIN?DIM_MAX?DIM_MAX);
????????return?2;
????}

????//?initialize?the?board
????init();

????//?accept?moves?until?game?is?won
????while?(true)
????{
????????//?clear?the?screen
????????clear();

????????//?draw?the?current?state?of?the?board
????????draw();

????????//?check?for?win
????????if?(won())
????????{
????????????printf(“ftw!\n“);
????????????break;
????????}

????????//?prompt?for?move
????????printf(“Tile?to?move:?“);
????????int?tile?=?GetInt();

????????//?move?if?possible?else?report?illegality
????????if?(!move(tile))
????????{
????????????printf(“\nIllegal?move.\n“);
????????????usleep(500000);
????????}

????????//?sleep?thread?for?animation‘s?sake
????????usleep(500000);
????}

????//?that‘s?all?folks
????return?0;
}


/*
?*?Clears?screen?using?ANSI?escape?sequences.
?*/

void
clear(void)
{
????printf(“\033[2J“);
????printf(“\033[%d;%dH“?0?0);
}


/*
?*?Greets?player.
?*/

void
greet(void)
{
????clear();
????printf(“WELCOME?TO?THE?GAME?OF?FIFTEEN\n“);
????usleep(2000000);
}


/*
?*?Initializes?the?game‘s?board?with?tiles?numbered?1?through?d*d?-?1
?*?(i.e.?fills?2D?array?with?values?but?does?not?actually?print?them).??
?*/

void
init(void)
{
????//?TODO
}


/*?
?*?Prints?the?board?in?its?current?state.
?*/

void
draw(void)
{
????//?TODO
}


/*?
?*?If?tile?borders?empty?space?moves?tile?and?returns?true?else
?*?returns?false.?
?*/

bool
move(int?tile)
{
????//?TODO
????return?false;
}


/*
?*?Returns?true?if?game?is?won?(i.e.?board?is?in?winning?configuration)?
?*?else?false.
?*/

bool
won(void)
{
????//?TODO
????return?false;
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2916??2011-02-12?14:21??pset4\debug.bin

?????文件?????331776??2011-02-12?14:21??pset4\l33t.bin

?????文件????????239??2011-09-30?06:33??pset4\Makefile

?????文件?????331776??2011-02-12?14:21??pset4\n00b.bin

?????文件??????12537??2011-02-12?14:21??pset4\sudoku.c

?????文件????????751??2011-02-12?14:21??pset4\sudoku.h

?????文件???????2013??2010-10-15?18:31??pset5\bmp\bmp.h

?????文件?????921656??2010-10-15?18:22??pset5\bmp\clue.bmp

?????文件???????2595??2010-10-15?18:21??pset5\bmp\copy.c

?????文件????????486??2010-10-15?18:21??pset5\bmp\large.bmp

?????文件????????429??2010-10-15?18:23??pset5\bmp\Makefile

?????文件?????????90??2010-10-15?18:21??pset5\bmp\small.bmp

?????文件????????246??2010-10-15?18:21??pset5\bmp\smiley.bmp

?????文件??????????0??2010-10-15?18:32??pset5\questions.txt

?????文件????????852??2010-10-23?10:31??pset6\dictionary.c

?????文件????????871??2010-10-23?10:31??pset6\dictionary.h

?????文件????????662??2010-10-23?10:31??pset6\Makefile

?????文件??????????0??2010-10-23?10:31??pset6\questions.txt

?????文件???????5141??2010-10-23?10:31??pset6\speller.c

?????文件?????167529??2010-09-11?13:15??pset6\texts\alice.txt

?????文件?????704132??2010-09-11?13:15??pset6\texts\austen.txt

?????文件?????159309??2010-09-11?13:15??pset6\texts\austinpowers.txt

?????文件?????182029??2010-09-11?13:15??pset6\texts\christmas.txt

?????文件??????45118??2010-09-11?13:15??pset6\texts\constitution.txt

?????文件????????875??2010-09-11?13:15??pset6\texts\daffodils.txt

?????文件?????874627??2010-09-11?13:15??pset6\texts\dracula.txt

?????文件????1205891??2010-09-11?13:15??pset6\texts\federalist.txt

?????文件?????463156??2010-09-11?13:15??pset6\texts\frankenstein.txt

?????文件?????532695??2010-09-11?13:15??pset6\texts\grimm.txt

?????文件????6617503??2010-09-11?13:15??pset6\texts\holmes.txt

............此處省略177個文件信息

評論

共有 條評論