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
#define GAME_H | |
#ifdef GAME_H | |
#include <iostream> | |
#include <cstdlib> | |
#include <iomanip> | |
const int MAXROW = 3; | |
const int MAXCOL = 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 <iostream> | |
int main() | |
{ | |
const int MAXVAL = 5; | |
int num[MAXVAL] = {22 , 1, 33, 9, 10}; | |
int temp = 0; | |
for(int i = 0; i < MAXVAL; i++) { /// sorts in descending order | |
for(int n = i + 1; n < MAXVAL; 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 <iostream> /// std::cout // std::endl | |
#include <vector> /// std::vector | |
#include <cctype> /// toupper(); | |
int main() | |
{ | |
std::vector<std::string> words; /// initialized a empty vector of string | |
std::string temp_word; /// stores an temporary input | |
while(std::cin >> temp_word) |
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 <iostream> | |
#include <vector> | |
int main() | |
{ | |
std::vector<int> v1 = {1}; | |
auto it1 = v1.begin(); | |
std::cout << *it1 << std::endl; | |
std::vector<int> v2(10, 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 <iostream> | |
#include <string> | |
#include <vector> | |
int main() | |
{ | |
std::vector<std::string> vec_str = {"helllllllllllllo"}; | |
for(auto it = vec_str.begin(); it != vec_str.end(); ++it) { | |
for(auto &c : *it) |
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 <iostream> | |
#include <vector> | |
int main() | |
{ | |
std::vector<int> num = {22, 1, 3, 4, 100, 4, 1, 6, 7}; | |
auto temp = 0, counter = 0; | |
for(std::vector<int>::iterator it1 = num.begin(); it1 != num.end(); ++it1) { | |
for(std::vector<int>::iterator it2 = num.begin() + (counter += 1); it2 != num.end(); ++it2) { |
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 <iostream> | |
#include <vector> | |
int main() | |
{ | |
std::vector<int> vec1 = {5, 6, 7, 8, 9, 10, 11}; | |
auto sum = 0, total = 0; | |
for(auto it = vec1.begin() + 1; it != vec1.end(); ++it) { | |
sum = *it + *(it - 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 <iostream> | |
#include <vector> | |
int main() | |
{ | |
std::vector<unsigned> scores(11, 0); | |
unsigned grade = 0; | |
auto it = scores.begin(); | |
for(;std::cin >> grade;) { |
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 <iostream> | |
int main() | |
{ | |
const unsigned MAXNUM = 10; | |
/// initialize 10 int objects | |
int num[MAXNUM] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; | |
/// declare 10 int array of pointers |
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 <iostream> | |
#include <cstdlib> | |
#include <string> | |
#include <fstream> | |
int binary_dec(long); | |
int main() | |
{ | |
long bin, num = 0; |