Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>
int main(int argc, char *argv[])
{
if (argc != 2)
{
#include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(void)
{
long long n = 0;
do
// 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"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t BYTE;
int main(int argc, char *argv[])
{
if (argc != 2)
{
// 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>
#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];
#include <cs50.h>
#include <stdio.h>
#include <string.h>
// Max number of candidates
#define MAX 9
// Candidates have name and vote count
typedef struct
{
#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;
#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)