Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // zad.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- #include <cmath>
- using namespace std;
- int main()
- {
- string genre, title;
- int average = 0;
- int arraysize = 10;
- int array[10];
- string movieArray[10];
- for (int i = 0; i < arraysize; i++)
- {
- cout << "Select Genre: Action, Crime, Adventure" << endl;
- LOOP:
- cin >> genre;
- if (genre == "Action")
- {
- cout << "Choose Title: Arrow, Supergirl" << endl;
- cin >> title;
- movieArray[i] = title;
- if (title == "Arrow")
- {
- LOOP2:
- cout << "Rate the show: ";
- cin >> array[i];
- if (array[i] < 1)
- {
- cout << "Invalid rating" << endl;
- goto LOOP2;
- }
- else if (array[i] > 6)
- {
- cout << "Invalid rating" << endl;
- goto LOOP2;
- }
- else
- {
- cout << "Arrow has been given a rating of " << array[i] << "." << endl;
- }
- }
- else if (title == "Supergirl")
- {
- LOOP3:
- cout << "Rate the show: ";
- cin >> array[i];
- if (array[i] < 1)
- {
- cout << "Invalid rating" << endl;
- goto LOOP3;
- }
- else if (array[i] > 6)
- {
- cout << "Invalid rating" << endl;
- goto LOOP3;
- }
- else
- {
- cout << "Arrow has been given a rating of " << array[i] << "." << endl;
- }
- }
- }
- else if (genre == "Crime")
- {
- cout << "Choose Title: Lucifer, Riverdale" << endl;
- cin >> title;
- movieArray[i] = title;
- if (title == "Lucifer")
- {
- LOOP4:
- cout << "Rate the show: ";
- cin >> array[i];
- if (array[i] < 1)
- {
- cout << "Invalid rating" << endl;
- goto LOOP4;
- }
- else if (array[i] > 6)
- {
- cout << "Invalid rating" << endl;
- goto LOOP4;
- }
- else
- {
- cout << "Lucifer has been given a rating of " << array[i] << "." << endl;
- }
- }
- else if (title == "Riverdale")
- {
- LOOP5:
- cout << "Rate the show: ";
- cin >> array[i];
- if (array[i] < 1)
- {
- cout << "Invalid rating" << endl;
- goto LOOP5;
- }
- else if (array[i] > 6)
- {
- cout << "Invalid rating" << endl;
- goto LOOP5;
- }
- else
- {
- cout << "Riverdale has been given a rating of " << array[i] << "." << endl;
- }
- }
- }
- else if (genre == "Adventure")
- {
- cout << "Choose Title: Vikings, Krypton" << endl;
- cin >> title;
- movieArray[i] = title;
- if (title == "Vikings")
- {
- LOOP6:
- cout << "Rate the show: ";
- cin >> array[i];
- if (array[i] < 1)
- {
- cout << "Invalid rating" << endl;
- goto LOOP6;
- }
- else if (array[i] > 6)
- {
- cout << "Invalid rating" << endl;
- goto LOOP6;
- }
- else
- {
- cout << "Vikings has been given a rating of " << array[i] << "." << endl;
- }
- }
- else if (title == "Krypton")
- {
- LOOP7:
- cout << "Rate the show: ";
- cin >> array[i];
- if (array[i] < 1)
- {
- cout << "Invalid rating" << endl;
- goto LOOP7;
- }
- else if (array[i] > 6)
- {
- cout << "Invalid rating" << endl;
- goto LOOP3;
- }
- else
- {
- cout << "Krypton has been given a rating of " << array[i] << "." << endl;
- }
- }
- }
- else
- {
- cout << "Please select one of the specified genres." << endl;
- goto LOOP;
- }
- }
- int averagearray[10];
- string movieAvarageArray[8];
- for (int i = 0; i < arraysize; i++)
- {
- for (int j = i; j < arraysize; j++)
- {
- if (movieArray[i] == movieArray[j])
- {
- average = average + (array[i] + array[j]) / 2;
- }
- }
- movieArray[i] = "";
- array[i] = 0;
- movieAvarageArray[i] = movieArray[i];
- averagearray[i] = average;
- average = 0;
- }
- cout << "stanko e gei" << endl;
- for (int i = 0; i < arraysize; ++i)
- {
- for (int j = i + 1; j < arraysize; ++j)
- {
- if (averagearray[i] < averagearray[j])
- {
- int a = averagearray[i];
- averagearray[i] = averagearray[j];
- averagearray[j] = a;
- string b = movieArray[i];
- movieArray[i] = movieArray[j];
- movieArray[j] = b;
- }
- }
- }
- for (int i = 0; i < arraysize; ++i)
- {
- cout << averagearray[i] << " " << movieArray[i] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement