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> | |
#include <string.h> | |
#define CHAR_TO_INT(c) (c - 0x30) | |
int IsValidPhoneNumber(char *phoneNumber, int length) | |
{ | |
for (int i = 0; i < length; i++) | |
if (CHAR_TO_INT(phoneNumber[i]) < 0 || CHAR_TO_INT(phoneNumber[i]) > 9) | |
return -1; |
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> | |
int mul(int a, int b) | |
{ | |
if (b == 1) | |
return a; | |
else if (b == 0) | |
return 0; | |
return (a << 1) + mul(a, b - 2); | |
} |
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> | |
#include <curses.h> | |
#include <time.h> | |
#define HORIZONTAL_BAR_LEN 3 | |
#define VERTICAL_BAR_LEN 2 | |
#define DIGIT_WIDTH ((HORIZONTAL_BAR_LEN * 2) + 5) | |
#define DIGIT_HEIGHT ((VERTICAL_BAR_LEN * 2) + 3) |
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> | |
void printThing(char array[3][3]) | |
{ | |
for (int y = 0; y < 3; y++) | |
{ | |
for (int x = 0; x < 3; x++) | |
{ | |
printf("%c", array[y][x]); | |
} |
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 <ncurses.h> | |
#define KEY_ESC 27 | |
int main() | |
{ | |
initscr(); | |
keypad(stdscr, true); | |
// don't print out the text the user enters | |
noecho(); |
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 "EssayScrambler.h" | |
using namespace std; | |
EssayScrambler::EssayScrambler(const string &essayText) : | |
essayText(essayText) | |
{ | |
parseText(); | |
} |
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> | |
#include <stdlib.h> | |
#include <sys/queue.h> | |
struct _Student | |
{ | |
LIST_ENTRY(_Student) entries; | |
char name[20]; | |
int age; | |
float gpa; |
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
Element = Struct.new(:symbol, :name) | |
elements = [] | |
def word2Element(w, builder, elements) | |
if w.length == 0 | |
return builder | |
end | |
# check for 1 char symbol |
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> | |
#include <stdlib.h> | |
typedef unsigned long DWORD; | |
typedef unsigned char BYTE; | |
typedef struct | |
{ | |
DWORD magic; // 0x4D433032, ASCII = "MC02" | |
DWORD fileLength; |
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
using System; | |
using System.Drawing; | |
using System.Windows.Forms; | |
namespace DrawingStuff | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ |
NewerOlder