summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorpants <niklasjo2004@gmail.com>2026-09-21 14:17:03 -0700
committerpants <niklasjo2004@gmail.com>2026-09-21 14:17:03 -0700
commit7b21727285e50b0b050c4ddd70d07542229c5366 (patch)
tree5d369153c5df5b41f3750d25479a68f20169c8ff /cpp
init
Diffstat (limited to 'cpp')
-rw-r--r--cpp/arrays.cpp10
-rw-r--r--cpp/print.cpp17
-rw-r--r--cpp/structs.cpp19
3 files changed, 46 insertions, 0 deletions
diff --git a/cpp/arrays.cpp b/cpp/arrays.cpp
new file mode 100644
index 0000000..b7bbe36
--- /dev/null
+++ b/cpp/arrays.cpp
@@ -0,0 +1,10 @@
+#include <iostream>
+using namespace std;
+
+int main() {
+ int numbers[] = {2,4,8,16};
+ for (int number : numbers) {
+ cout << number << endl;
+ }
+ return 0;
+} \ No newline at end of file
diff --git a/cpp/print.cpp b/cpp/print.cpp
new file mode 100644
index 0000000..f58b236
--- /dev/null
+++ b/cpp/print.cpp
@@ -0,0 +1,17 @@
+#include <iostream>
+#include <string>
+using namespace std;
+
+int main() {
+ int x;
+ string y = "this is stored as a string";
+ cout << "enter 1 to start: ";
+ cin >> x;
+ if (x = 1) {
+ for (float n = 0; n < 10; n += 0.000000001) {
+ cout << n << " " << endl;
+ }
+ }
+ return 0;
+}
+
diff --git a/cpp/structs.cpp b/cpp/structs.cpp
new file mode 100644
index 0000000..87be70c
--- /dev/null
+++ b/cpp/structs.cpp
@@ -0,0 +1,19 @@
+#include <iostream>
+#include <string>
+using namespace std;
+
+struct dog {
+ int age;
+ int weight;
+ string color;
+ string name;
+};
+
+int main() {
+ dog atlas;
+ atlas.age = 7;
+ atlas.weight = 77;
+ atlas.color = "black";
+ atlas.name = "Atlas";
+ cout << atlas.color << endl;
+}