1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
#include <iostream>
#include <string>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
int option;
int label;
int num;
double views;
int choice;
string artist;
string song;
int total;
//the program asks the user if they want to upload only one song or multiple songs
cout << " Wlecome to the CPCC uploading service!" << endl;
do {
cout << "Please choose from the following menu options by entering a number 1-3." << endl;
cout << "1. Upload one song to a streaming service" << endl;
cout << "2. Upload multiple songs to a streaming service" << endl;
cout << "3. End program" << endl;
cin >> option;
if (option == 3) {
cout << "Thank you for using the CPCC uploading service. Goodbye." << endl;
}
else if (option >= 4) {
cout << "Error: number entered is not an option for options 1-3" << endl;
}
// TIDAl= 0.0125, Amazon= 0.00402, AM(Apple Music)= 0.00737, Spotify= 0.00437, Youtube= 0.00069
double Tidal = 0.0125, Amazon = 0.00402, AM = 0.00737, Spotify = 0.00437, Youtube = 0.00069;
// Option 1 is if a user wants to upload only one song.
if (option == 1) {
cout << "which streaming service do you want to upload your song to?" << endl;
cout << "1: TIDAL" << endl;
cout << "2: Amazon" << endl;
cout << "3: Apple Music" << endl;
cout << "4: Spotify" << endl;
cout << "5: Youtube" << endl;
cout << "Please enter a number 1-5 to select which streaming service you want to upload your song to." << endl;
cin >> choice;
if (choice == 1) {
cout << " How many views does the song have? " << endl;
cin >> views;
cin.ignore();
cout << " What is the Artist's name?" << endl;
getline(cin, artist);
cout << " What song from the artist do you want to upload? " << endl;
getline(cin, song);
cout << "Song Name: " << song << endl;
cout << "Artist's Name: " << artist << endl;
cout << "Streaming Service: " << "TIDAL" << endl;
cout << "Money Made $ " << (Tidal * views) << endl;
}
if (choice == 2) {
cout << " How many views does the song have? " << endl;
cin >> views;
cin.ignore();
cout << " What is the Artist's name?" << endl;
getline(cin, artist);
cout << " What song from the artist do you want to upload?" << endl;
getline(cin, song);
cout << "Song Name: " << song << endl;
cout << "Artist's Name: " << artist << endl;
cout << "Streaming Service: " << "Amazon" << endl;
cout << "Money Made $ " << (Amazon * views) << endl;
}
if (choice == 3) {
cout << " How many views does the song have? " << endl;
cin >> views;
cin.ignore();
cout << " What is the Artist's name? " << endl;
getline(cin, artist);
cout << " What song from the artist do you want to upload? " << endl;
getline(cin, song);
cout << "Song Name: " << song << endl;
cout << "Artist's Name: " << artist << endl;
cout << "Streaming Service: " << "Apple Music" << endl;
cout << "Money Made $ " << (AM * views) << endl;
}
if (choice == 4) {
cout << " How many views does the song have? " << endl;
cin >> views;
cin.ignore();
cout << " What is the Artist's name" << endl;
getline(cin, artist);
cout << " What song from the artist do you want to upload?" << endl;
getline(cin, song);
cout << "Song Name: " << song << endl;
cout << "Artist's Name: " << artist << endl;
cout << "Streaming Service: " << "Spotify" << endl;
cout << "Money Made $ " << (Spotify * views);
}
if (choice == 5) {
cout << " How many views does the song have? " << endl;
cin >> views;
cin.ignore();
cout << " What is the Artist's name? " << endl;
getline(cin, artist);
cout << " What song from the artist do you want to upload? " << endl;
getline(cin, song);
cout << "Song Name: " << song << endl;
cout << "Artist's Name: " << artist << endl;
cout << "Streaming Service: " << "Youtube" << endl;
cout << "Money Made $ " << (Youtube * views);
}
}
// option 2 is where the user can upload multiple songs. Another option is added where the user can end the program after they upload their songs.
else if (option == 2) {
cout << "which streaming service will you use to upload your songs?" << endl;
cout << "1: TIDAL" << endl;
cout << "2: Amazon" << endl;
cout << "3: Apple Music" << endl;
cout << "4: Spotify" << endl;
cout << "5: Youtube" << endl;
cin >> choice;
cout << "How many songs do you want to upload?" << endl;
cin >> num;
if (num <= 0) {
cout << "Error: the number of songs you want to upload must be greater than 0." << endl;
}
cout << "Please enter 1 or 2 to select the type of distribution to use for your songs." << endl;
cout << "1: Major Label" << endl;
cout << "2: Independent Label" << endl;
cin >> label;
srand(num);
for (int song = 0; song < num; song++) {
if (label == 1) {
// major labels generate between 100,000 and 50,000,000 streams
num = 100000 + rand() % 49900000;
} else {
// indie labels generate between 10,000 and 1,000,000 streams
num = 10000 + rand() % 990000;
}
// add to the total streams
total += num;
// output the song number and the streams
cout << "\t Song #" << (song + 1) << ": \t" << num << " streams" << endl;
}
return 0;
}
} while (option != 3);
return 0;
}
|