This file contains hidden or 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
import java.io.File; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
//Seriously why do I have to import 3 things so get the date. Java = superflous objects everywhere | |
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.util.Calendar; | |
public final class SimpleLog{ |
This file contains hidden or 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> | |
//Compile with: $cc counter.c | |
//run with ./a.out | |
main(){ | |
int i; | |
for (i = 0; i < 10; ++i){ | |
//The \b is a lesser known escape character that moves the cursor back one. Allowing you to overwrite what you've previously written. | |
printf("\b%i",i); |
This file contains hidden or 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> | |
main(){ | |
int c; | |
while((c = getchar()) != EOF){ | |
putchar(c); | |
if(c == ' '){ | |
while((c = getchar()) == ' ') | |
; | |
putchar(c); |
This file contains hidden or 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> | |
main(){ | |
int c; | |
while((c = getchar()) != EOF){ | |
if(c == '\n'){ | |
putchar(' '); | |
while((c = getchar()) == '\n') | |
; |
This file contains hidden or 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> | |
//In a word or not | |
#define IN 1 | |
#define OUT 0 | |
#define MAXLENGTH 100 | |
// Write a program to print a histogram of the lengths of words in its input. It is easy to draw the historgram with the bars horizontal; a vertical orientation is more challenging. | |
main(){ | |
//Maximum word length is 100, far more than neccesary |
This file contains hidden or 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> | |
#define MAXLINE 1000 | |
int ourgetline(char line[], int maxline); | |
void copy(char to[], char from[]); | |
main(){ | |
int len, max; | |
char line[MAXLINE]; | |
char longest[MAXLINE]; |
This file contains hidden or 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> | |
#define MAXLENGTH 1000 | |
//Write a function reverse(s) that reverses the character string s. Use it to write a program that reverses its input line by line | |
void reverse(char s[], int lim){ | |
int i,j; | |
j=lim-1; | |
i=0; |
This file contains hidden or 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> | |
/* Write a program to remove all comments from a C program, | |
Don't forget to handle quoted strings and character constants | |
properly. C Comments do not nest */ | |
main(){ | |
int first,second ,eatChar,lookAhead,previous; | |
first = getchar(); | |
while((second = getchar()) != EOF){ |
This file contains hidden or 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> | |
/* | |
Write a program to fold long input lines into two or more shorter lines after the last non-blank character that occurs before the n-th column of input. Make sure your program does something intelligent with very long lines, and if there are no blanks or tabs before the specified column. | |
*/ | |
#define COLUMN_WIDTH 80 | |
#define MAX_LINE 1000 | |
This file contains hidden or 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> | |
/* | |
Fun Fact: | |
Using an unsigned integer causes integer arithmetic module 2^n where n is the number of bits in the type | |
*/ | |
main(){ | |
unsigned char mod256; | |
mod256 = 16*18; |
OlderNewer