th3eternal1
Notable Member
- Dec 3, 2020
- 1,252
- 12,380
correct hehe6 AND -6![]()
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
correct hehe6 AND -6![]()
look at what i just got done writingTake that back poopy![]()
look at what i just got done writing
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <list>
// Function to display the vector when we need to
void display(const std::vector<int> &vec) {
std::cout << "\n";
for(auto const &i : vec) {
std::cout << i << " ";
}
std::cout << "\n";
}
void test_1() {
std::vector<int> nums = {1, 2, 3, 4, 5};
auto it = nums.begin();
std::cout << *it << std::endl;
it++;
std::cout << *it << std::endl;
it += 2;
std::cout << *it << std::endl;
it = nums.end() - 1;
std::cout << *it << std::endl;
}
void test_2() {
std::cout << "\n========== Function 2 ==========\n" << std::endl;
std::vector<int> nums = {1, 2, 3, 4, 5};
std::vector<int>::iterator it = nums.begin();
while(it != nums.end()) {
std::cout << *it << std::endl;
it++;
}
it = nums.begin();
while(it != nums.end()) {
*it = 0;
it++;
}
display(nums);
}
void test_3() {
std::cout << "\n========== Function 3 ==========\n" << std::endl;
// Using a constant iterator
std::vector<int> nums = {1, 2, 3, 4, 5};
std::vector<int>::const_iterator it = nums.begin();
// Same as: auto it = nums.cbegin();
while(it != nums.end()) {
std::cout << *it << std::endl;
it++;
}
// However, attempting to mutate the vector will result in a compiler error!
}
void test_4() {
std::cout << "\n========== Function 4 ==========\n" << std::endl;
// Using a reverse iterator
std::vector<int> vec = {1, 2, 3, 4, 5};
auto it = vec.rbegin(); // 5
while(it != vec.rend()) {
std::cout << *it << std::endl;
it++;
}
std::cout << "\n";
// Const reverse iterator over a list
std::list<std::string> names = {"Larry", "Moe", "Curly"};
auto it_2 = names.crbegin();
std::cout << *it_2 << std::endl;
it++; // Points to Moe
std::cout << *it_2 << std::endl;
std::cout << "\n";
// Iterate over a map
std::map<std::string, std::string> favs;
favs.insert({"Frank", "C++"});
favs.insert({"Joma", "Python"});
favs.insert({"Jonas", "JavaScript"});
auto it_3 = favs.begin();
while(it_3 != favs.end()) {
std::cout << it_3 -> first << " likes " << it_3 -> second << std::endl;
it_3++;
}
}
void test_5() {
std::cout << "\n========== Function 5 ==========\n" << std::endl;
std::vector<int> vec = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
// We can start and begin where desired
auto start = vec.begin() + 2; // 3
auto finish = vec.end() - 3; // 8
while(start != finish) {
std::cout << *start << std::endl;
start++;
}
}
int main() {
// 5 example functions of how iterators work
test_1();
test_2();
test_3();
test_4();
test_5();
return 0;
}























talented who 






Interesting list of functions. I found it interesting that you loaded libraries that weren't used and I also like the usage of arrays. It seems like the way in which you write comments in your code is a lot more professional than on forums. lollook at what i just got done writing
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <list>
// Function to display the vector when we need to
void display(const std::vector<int> &vec) {
std::cout << "\n";
for(auto const &i : vec) {
std::cout << i << " ";
}
std::cout << "\n";
}
void test_1() {
std::vector<int> nums = {1, 2, 3, 4, 5};
auto it = nums.begin();
std::cout << *it << std::endl;
it++;
std::cout << *it << std::endl;
it += 2;
std::cout << *it << std::endl;
it = nums.end() - 1;
std::cout << *it << std::endl;
}
void test_2() {
std::cout << "\n========== Function 2 ==========\n" << std::endl;
std::vector<int> nums = {1, 2, 3, 4, 5};
std::vector<int>::iterator it = nums.begin();
while(it != nums.end()) {
std::cout << *it << std::endl;
it++;
}
it = nums.begin();
while(it != nums.end()) {
*it = 0;
it++;
}
display(nums);
}
void test_3() {
std::cout << "\n========== Function 3 ==========\n" << std::endl;
// Using a constant iterator
std::vector<int> nums = {1, 2, 3, 4, 5};
std::vector<int>::const_iterator it = nums.begin();
// Same as: auto it = nums.cbegin();
while(it != nums.end()) {
std::cout << *it << std::endl;
it++;
}
// However, attempting to mutate the vector will result in a compiler error!
}
void test_4() {
std::cout << "\n========== Function 4 ==========\n" << std::endl;
// Using a reverse iterator
std::vector<int> vec = {1, 2, 3, 4, 5};
auto it = vec.rbegin(); // 5
while(it != vec.rend()) {
std::cout << *it << std::endl;
it++;
}
std::cout << "\n";
// Const reverse iterator over a list
std::list<std::string> names = {"Larry", "Moe", "Curly"};
auto it_2 = names.crbegin();
std::cout << *it_2 << std::endl;
it++; // Points to Moe
std::cout << *it_2 << std::endl;
std::cout << "\n";
// Iterate over a map
std::map<std::string, std::string> favs;
favs.insert({"Frank", "C++"});
favs.insert({"Joma", "Python"});
favs.insert({"Jonas", "JavaScript"});
auto it_3 = favs.begin();
while(it_3 != favs.end()) {
std::cout << it_3 -> first << " likes " << it_3 -> second << std::endl;
it_3++;
}
}
void test_5() {
std::cout << "\n========== Function 5 ==========\n" << std::endl;
std::vector<int> vec = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
// We can start and begin where desired
auto start = vec.begin() + 2; // 3
auto finish = vec.end() - 3; // 8
while(start != finish) {
std::cout << *start << std::endl;
start++;
}
}
int main() {
// 5 example functions of how iterators work
test_1();
test_2();
test_3();
test_4();
test_5();
return 0;
}
Haha yeah I like to write functions like these for future reference and stuff. How's Python anyway? I want to go into the more advanced features soonInteresting list of functions. I found it interesting that you loaded libraries that weren't used and I also like the usage of arrays. It seems like the way in which you write comments in your code is a lot more professional than on forums. lol
Python is pretty decent. Didn't spend too much time on it although I thought it wasn't that difficult to get into and really experiment with.Haha yeah I like to write functions like these for future reference and stuff. How's Python anyway? I want to go into the more advanced features soon
Haha yeah I like to write functions like these for future reference and stuff. How's Python anyway? I want to go into the more advanced features soon
you are*when you're are as slow as an turtle yet you're still here![]()
As a python coder and Java you need to set a variable to return the code And repeat it, this Means She is only a small nerd it’s nice knowing someone else loves coding too!look at what i just got done writing
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <list>
// Function to display the vector when we need to
void display(const std::vector<int> &vec) {
std::cout << "\n";
for(auto const &i : vec) {
std::cout << i << " ";
}
std::cout << "\n";
}
void test_1() {
std::vector<int> nums = {1, 2, 3, 4, 5};
auto it = nums.begin();
std::cout << *it << std::endl;
it++;
std::cout << *it << std::endl;
it += 2;
std::cout << *it << std::endl;
it = nums.end() - 1;
std::cout << *it << std::endl;
}
void test_2() {
std::cout << "\n========== Function 2 ==========\n" << std::endl;
std::vector<int> nums = {1, 2, 3, 4, 5};
std::vector<int>::iterator it = nums.begin();
while(it != nums.end()) {
std::cout << *it << std::endl;
it++;
}
it = nums.begin();
while(it != nums.end()) {
*it = 0;
it++;
}
display(nums);
}
void test_3() {
std::cout << "\n========== Function 3 ==========\n" << std::endl;
// Using a constant iterator
std::vector<int> nums = {1, 2, 3, 4, 5};
std::vector<int>::const_iterator it = nums.begin();
// Same as: auto it = nums.cbegin();
while(it != nums.end()) {
std::cout << *it << std::endl;
it++;
}
// However, attempting to mutate the vector will result in a compiler error!
}
void test_4() {
std::cout << "\n========== Function 4 ==========\n" << std::endl;
// Using a reverse iterator
std::vector<int> vec = {1, 2, 3, 4, 5};
auto it = vec.rbegin(); // 5
while(it != vec.rend()) {
std::cout << *it << std::endl;
it++;
}
std::cout << "\n";
// Const reverse iterator over a list
std::list<std::string> names = {"Larry", "Moe", "Curly"};
auto it_2 = names.crbegin();
std::cout << *it_2 << std::endl;
it++; // Points to Moe
std::cout << *it_2 << std::endl;
std::cout << "\n";
// Iterate over a map
std::map<std::string, std::string> favs;
favs.insert({"Frank", "C++"});
favs.insert({"Joma", "Python"});
favs.insert({"Jonas", "JavaScript"});
auto it_3 = favs.begin();
while(it_3 != favs.end()) {
std::cout << it_3 -> first << " likes " << it_3 -> second << std::endl;
it_3++;
}
}
void test_5() {
std::cout << "\n========== Function 5 ==========\n" << std::endl;
std::vector<int> vec = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
// We can start and begin where desired
auto start = vec.begin() + 2; // 3
auto finish = vec.end() - 3; // 8
while(start != finish) {
std::cout << *start << std::endl;
start++;
}
}
int main() {
// 5 example functions of how iterators work
test_1();
test_2();
test_3();
test_4();
test_5();
return 0;
}
As a python coder and Java you need to set a variable to return the code And repeat it, this Means She is only a small nerd it’s nice knowing someone else loves coding too!
one time I hacked into the schools gogaurdian but go expelled
fun fact: I created a VPN using python websites
Agreed. Python is not the right language to program your own VPN in if you were to go ahead and do that for some reason. Also that page is designed through html.
You’re right thanks for telling meAgreed. Python is not the right language to program your own VPN in if you were to go ahead and do that for some reason. Also that page is designed through html.
Having a vpn does require quite a bit of specialized networking hardware as you are basically passing through networking information within your own networking equipment rather than what your internet service provider has to offer.
I will prolly need help but Tysm for the info, As I’m tryna become an app creator