init
This commit is contained in:
10
cpp/arrays.cpp
Normal file
10
cpp/arrays.cpp
Normal file
@ -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;
|
||||
}
|
||||
17
cpp/print.cpp
Normal file
17
cpp/print.cpp
Normal file
@ -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;
|
||||
}
|
||||
|
||||
19
cpp/structs.cpp
Normal file
19
cpp/structs.cpp
Normal file
@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user