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 <iostream> | |
using namespace std; | |
void refFunc(int &);//Function headers. They do not require a name or body at this point. | |
void pointerFunc(int *); | |
int main() | |
{ | |
int something = 32; //Declare something as 32. |
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 <iostream> | |
using namespace std; | |
#define ARRAY_SIZE 128 | |
void lol(const int); //Function header for lol. | |
int main() | |
{ |
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 <iostream> | |
#include <iomanip> | |
using namespace std; | |
int main() | |
{ | |
//Note that in the below example I do not validate the numbers. This is bad practice. Don't do it. | |
int numStudents, | |
numScores, //Values can be separated by comma if they have the same base type. |
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 <iostream> | |
#include <iomanip> | |
#include <random> | |
using namespace std; | |
//See function bodies for comments on these. | |
int * createArray(int & size); | |
void findStats(int * arr, int size, int & min, int & max, double & average); |
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
#define MAX_INVENTORY 100 | |
//Arguments to use in cin.ignore: | |
#define IGNORE_ARGS 256, '\n' | |
#include <fstream> | |
#include <iomanip> | |
#include <iostream> | |
#include <string> |
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
<?php | |
//To echo everything alphabetically: | |
// includeJS("./"); | |
//includeJS can take an entry set or a path. | |
//For getting an entry set: | |
// getJSEntries($path [, $baseentries = []]) | |
//$baseentries can be specified so that all file entries within $baseentries will be ignored. | |
//If $path is a file, it adds that file to the existing entries (specified by $baseentries). | |
//If $path is a folder, it does the same as the above for each file. Note that folder searches are recursive. | |
//The return result is the $baseentries array, merged with the sorted results of getJSEntries. |
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
//Format for functions: | |
//type name (arguments) | |
//{} | |
char * myFunction (int lol) | |
{ | |
//Variables: | |
//type name; | |
char * myArray; | |
//Initializing to new array: |
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 <iostream> | |
using namespace std; | |
char * myFunction(const char * str) | |
{ | |
//Declare the fixed size array of 32 ize. | |
char fixedSizeArray[32]; | |
//Copy str into it. | |
strcpy(fixedSizeArray, str); |
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
//Question 12 answer | |
//Given this struct: | |
struct student | |
{ | |
string name; | |
int credits; | |
double grades[6]; | |
}; | |
student * highestGrade(student students[], int numberOfStudents) |
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 <iostream> | |
using namespace std; | |
#define LONG_NAME_SIZE 512 | |
void main() | |
{ | |
int numNames = 0; |
OlderNewer