コード例 #1
0
ファイル: water.c プロジェクト: banunatina/cs50
int main(void)
{
  int mins = GetPositiveInt();
  // converts minutes to bottles 
  mins = (mins * 1.5 * 128) / 16;
  // prints the number of bottles
  printf("bottles: %i\n", mins);
}
コード例 #2
0
ファイル: mario.c プロジェクト: jihdeh/cs50
int main(void) {
    int c = GetPositiveInt();
    for(int i = 0; i < c; i++){
        for(int j=0; j < c-i-1; j++){
            printf("%s", " ");
        }
        
        for(int k=0; k < i+2; k++){
            printf("#");
        }
        printf("\n");
    }
    return 0;
}
コード例 #3
0
int main() {
    Randomize();
    int numVoters;
    double percentSpread, percentError;

    cout << "Enter number of voters: ";
    numVoters = GetPositiveInt();
    cout << "Enter percentage spread between candidates: ";
    percentSpread = GetPercent();
    cout << "Enter voting error percentage: ";
    percentError = GetPercent();

    cout << endl;
    double chance = chanceOfInvalid(numVoters, percentSpread, percentError);
    cout << "Chance of an invalid election result "
	 << "after 500 trials = " << chance << endl;
    return 0;
}
コード例 #4
0
ファイル: function-1.c プロジェクト: stevepm/cs50
int main(void)
{
	int n = GetPositiveInt();
	printf("Thanks for the %i!\n", n);
}
コード例 #5
0
ファイル: functions1.c プロジェクト: windmill654/CS50
int main (void)
{
    int n = GetPositiveInt ();
    PrintInt (n);
}