Skip to content

Instantly share code, notes, and snippets.

View b-adams's full-sized avatar

Prof. Bryant E Adams b-adams

  • Wells College
  • Aurora NY
View GitHub Profile
#include <stdio.h>
const int ALLS_WELL_THAT_ENDS_WELL = 0;
int main(int argc, char* argv[])
{
return ALLS_WELL_THAT_ENDS_WELL;
}
Greeter := Object clone
Greeter greet := method(name, "Greetings " .. name println)
command := "greet(\"Jamie\")"
Greeter doString(command)
Test := String clone
//==>
Test = "Hello"
//==> Hello
Test type
//==> Sequence
Test size
//==> 5
Test = 7
//==> 7
#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);
#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();
#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();
bool hasNotGuessedCorrectly;
hasNotGuessedCorrectly = true;
while(hasNotGuessedCorrectly)
{
if(yourGuess < myNumber)
{
printf("Too low.\n");
}
else
#include <stdio.h>
int getNumberFromUser();
int main(int argc, char* argv[])
{
int usersNumber;
int i;
printf("MAIN BEGINS!\n");
/**
@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.
*/
@b-adams
b-adams / cs131_instructions_for_jceroalo.txt
Created October 1, 2011 00:21
Post-by-gist instructions
-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)