Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <windows.h>
- using namespace std;
- int arraySize;
- void optionOne(int n) {
- int* array = new int[n];
- int num = 1;
- for (int i=0; i < n; i++) {
- if (num == 4) {
- num = 1;
- array[i] = num;
- }
- else {
- array[i] = num;
- }
- cout << array[i] << endl;
- num++;
- }
- }
- void optionTwo(int n)
- {
- int* array = new int[n];
- int num = 1;
- for (int i = 0; i < n; i++) {
- if (num > 32) {
- num = 1;
- cout << num << endl;
- }
- else {
- cout << num << endl;
- }
- num = num * 2;
- }
- }
- void optionThree(int n) {
- int* array = new int[n];
- int k = 0;
- int l = 1;
- for (int i = 1; i <= n; i++) {
- for (int j = 0; j <= k; j++) {
- array[i - 1] = l;
- //cout << i << " " << tablica << " " << l << endl;
- l = l * 2;
- i++;
- }
- i--;
- k++;
- l = 1;
- }
- for (int i = 0; i < n; i++) {
- cout << array[i] << endl;
- }
- }
- void optionFour(int n) {
- int* array = new int[n];
- int num = 1;
- array[0] = num;
- cout << array[0] << endl;
- for (int i = 1; i <= n; i++) {
- array[i] = num;
- num *= 2;
- cout << array[i] << endl;
- }
- }
- void optionFive(int n) {
- int* array = new int[n];
- for (int i = 0; i < n; i++) {
- if (i == 0 || i % 4 == 0) {
- cout << "A" << endl ;
- }
- else if(i == 1 || i % 4 == 1) {
- cout << "C" << endl ;
- }
- else if (i == 2 || i % 4 == 2) {
- cout << "E" << endl ;
- }
- else if (i == 3 || i % 4 == 3) {
- cout << "F" << endl ;
- }
- }
- }
- void optionSix(int n) {
- int* array = new int[n];
- for (int i = 0; i < n; i++) {
- if (i == 0 || i == 7 || i % 8 == 0 || i % 8 == 7) {
- cout << "A" << endl;
- }
- else if (i == 1 || i == 6 || i % 8 == 1 || i % 8 == 6) {
- cout << "C" << endl;
- }
- else if (i == 2 || i == 5 || i % 8 == 2 || i % 8 == 5) {
- cout << "E" << endl;
- }
- else if (i == 3 || i == 4 || i % 8 == 3 || i % 8 == 4) {
- cout << "F" << endl;
- }
- }
- }
- void optionSeven(int n) {
- int* array = new int[n];
- int i;
- double a, b, iFloat;
- // iFloat = i;
- cout << endl << "Type a: ";
- cin >> a;
- cout << endl << "Type b: ";
- cin >> b;
- if (i % 2 == 1) {
- (cbrt(fabs(a + b + iFloat))) / (a - b);
- }
- else {
- sqrt(pow(a, 2) + pow(b, 2) + i);
- }
- }
- /*
- int main()
- {
- while (1) {
- cout << "Type size of array: ";
- cin >> arraySize;
- int choose;
- cout << endl << "Choose type of filling method :" << endl;
- cout << "1. 1 2 3 1 2 3 1 2 3 ..." << endl;
- cout << "2. 1 2 4 8 16 32 1 2 4 8 16 32 1 2 4 8 16 32 ..." << endl;
- cout << "3. 1 1 2 1 2 4 1 2 4 8 1 2 4 8 16 ..." << endl;
- cout << "4. 1 1 2 4 8 16 32 64 128 ..." << endl;
- cout << "5. A C E F A C E F A C E F ..." << endl;
- cout << "6. A C E F F E C A A C E F F E C A A C E F F E C A ..." << endl;
- cout << "Option: ";
- cin >> choose;
- switch (choose) {
- case 1:
- optionOne(arraySize);
- break;
- case 2:
- optionTwo(arraySize);
- break;
- case 3:
- optionThree(arraySize);
- break;
- case 4:
- optionFour(arraySize);
- break;
- case 5:
- optionFive(arraySize);
- break;
- case 6:
- optionSix(arraySize);
- break;
- case 7:
- optionSeven(arraySize);
- break;
- }
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement