From a33d49ac4d1ce554c72770927957a089b4023bf1 Mon Sep 17 00:00:00 2001 From: pants Date: Mon, 21 Sep 2026 14:17:45 -0700 Subject: init --- cpp/arrays.cpp | 10 ++++++++++ cpp/print.cpp | 17 +++++++++++++++++ cpp/structs.cpp | 19 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 cpp/arrays.cpp create mode 100644 cpp/print.cpp create mode 100644 cpp/structs.cpp (limited to 'cpp') 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 +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 +#include +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 +#include +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; +} -- cgit v1.2.3