This file contains 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 <cs50.h> | |
#include <string.h> | |
#include <ctype.h> | |
#include <stdlib.h> | |
int main(int argc, string argv[]) | |
{ | |
//checks if user has inputed a command line argument, if not returns error message | |
if (argc == 2) |
This file contains 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 <cs50.h> | |
#include <string.h> | |
#include <ctype.h> | |
#include <stdlib.h> | |
int main(int argc, string argv[]) | |
{ | |
//checks if user input exactly 1 command line argument, if not prints out error message |
This file contains 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 <cs50.h> | |
#include <string.h> | |
#include <ctype.h> | |
#include <math.h> | |
int main(void) | |
{ | |
// gets text input from user | |
string text = get_string("Text: "); |
This file contains 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 <cs50.h> | |
#include <math.h> | |
int main(void) | |
{ | |
//gets a valid number from the user | |
long long int credit_card; | |
do | |
{ |
This file contains 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 <cs50.h> | |
#include <math.h> | |
float get_positive_float(void); | |
int main(void) | |
{ | |
//creates variable "change" (amount of cents due) and varable "coins" (the amount of coins to be given out) | |
float change = round(get_positive_float() * 100); |
This file contains 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> | |
//mentions function "get_height" so we can use it later on | |
int get_height(string prompt); | |
//main code | |
int main(void) | |
{ | |
int n = get_height("Height: "); |
This file contains 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> | |
//mentions function "get_height" so we can use it later on | |
int get_height(string prompt); | |
//main code | |
int main(void) | |
{ | |
int n = get_height("Height: "); |
This file contains 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 <cs50.h> | |
int main(void) | |
{ | |
printf("hello, %s\n", get_string("What is your name?\n")); | |
} |