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> | |
const int ALLS_WELL_THAT_ENDS_WELL = 0; | |
int main(int argc, char* argv[]) | |
{ | |
return ALLS_WELL_THAT_ENDS_WELL; | |
} |
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
Greeter := Object clone | |
Greeter greet := method(name, "Greetings " .. name println) | |
command := "greet(\"Jamie\")" | |
Greeter doString(command) |
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
Test := String clone | |
//==> | |
Test = "Hello" | |
//==> Hello | |
Test type | |
//==> Sequence | |
Test size | |
//==> 5 | |
Test = 7 | |
//==> 7 |
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> | |
const float PI=3.14; | |
int main() | |
{ | |
int r; | |
printf("Enter the radius:\n"); | |
scanf("%d",&r); | |
printf("The area of your circle is about %d\n",PI*r*r); |
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> | |
const int EGGS_IN_CARTON = 12; | |
const int HUNGRY_PEOPLE = 3; | |
const int DAYS_OF_X = 12; | |
const int SINGERS = 3; | |
void reportOnEggs(); | |
void reportOnPackets(); |
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> | |
//Eliminating magic numbers 4, 4, 10, 2, 3 | |
//const int ARBITRARY_5=4; | |
const int ARBITRARY_4=4; | |
const int ARBITRARY_3=10; | |
const int ARBITRARY_2=2; | |
const int ARBITRARY_1=3; | |
int getANumber(); |
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
bool hasNotGuessedCorrectly; | |
hasNotGuessedCorrectly = true; | |
while(hasNotGuessedCorrectly) | |
{ | |
if(yourGuess < myNumber) | |
{ | |
printf("Too low.\n"); | |
} | |
else |
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> | |
int getNumberFromUser(); | |
int main(int argc, char* argv[]) | |
{ | |
int usersNumber; | |
int i; | |
printf("MAIN BEGINS!\n"); |
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
/** | |
@brief Gets the user to pick a number | |
@sideeffect Prompts the user to enter a number | |
@returns The number the user entered | |
This function scans the user's input into a local variable, | |
and then returns the value stored in that variable to the calling code. | |
*/ |
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
-Open a new browser window, with the URL gist.github.com | |
-In the "Gist description…" box, enter "CS131 Program 2, JCeroalo" | |
-In the "name this file…" box, enter the appropriate filename | |
-In the Language drop down, select C | |
-In the big box, paste your code in | |
-Click the "Create Public Gist" button | |
-Proofread. Click 'edit' to edit if you see mistakes. | |
-Send me the url of the page you end up on (it should look like https://gist.github.com/SOME_NUMBER) |
OlderNewer