This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <cs50.h> | |
#include <ctype.h> | |
#include <string.h> | |
int main(int argc, char *argv[]) | |
{ | |
if (argc != 2) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <string.h> | |
int main(void) | |
{ | |
long long n = 0; | |
do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implements a dictionary's functionality | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <strings.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <ctype.h> | |
#include "dictionary.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
typedef uint8_t BYTE; | |
int main(int argc, char *argv[]) | |
{ | |
if (argc != 2) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// when use round and do dividing, attention: int/int return int, | |
//as for int/int, | |
// float x = 55; // stored as 54.999999... | |
// x = x + 0.5 (- 0.5) (x<0); // x is now 55.499999... | |
// int y = (int)x; // truncated to 55 | |
//float a; | |
//int b = (int)(a + 0.5); | |
//+0.5是四舍五入的关键 | |
#include "helpers.h" | |
#include <math.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdio.h> | |
#include <string.h> | |
// Max voters and candidates | |
#define MAX_VOTERS 100 | |
#define MAX_CANDIDATES 9 | |
// preferences[i][j] is jth preference for voter i | |
int preferences[MAX_VOTERS][MAX_CANDIDATES]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdio.h> | |
#include <string.h> | |
// Max number of candidates | |
#define MAX 9 | |
// Candidates have name and vote count | |
typedef struct | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <ctype.h> | |
int main(int argc, string argv[]) | |
{ | |
//if agrv[1] is not number, atoi(agrv[1]=0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
int count_letters(string s); | |
int count_words(string s); | |
int count_sentences(string s); | |
int main(void) |