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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
|
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
int bodyProgram()
{
int A;
cout << "How many activities do you have per weekday this week?: ";
cin >> A;
string NumActivities[7][2] =
{
{
"How much time do you spend per meal?:",
"How many meals do you have per day?:",
},
{
"How much time do you spend in the bathroom? (Excluding taking a pee):",
"How many times do you go to the bathroom per day?:",
},
{
"When do you wake up?(ex. 7:00am should be typed as 07 00): ",
},
{
"How many naps do you take per day?(Enter 0 if none):",
"How long per nap?(0 if none):",
},
{
"Do you take any breaks, excluding meals? (Enter 0 if none):",
"How long per break?(0 if none):",
},
{
"How much time do you spend at work or school? (H:M ex. 7 hours and 10 minutes is 7 10):",
"How much time do you spend commuting each way (In minutes)?:",
},
{
"Enter the name of the activity:",
"Enter the priority level of the activity from 1-10, 1 being optional and 10 being of utmost importance:",
},
};
string Name[100];
float Time[6];
float Amount[6];
float NormalSleep;
float NormalSchool;
float Normal;
int priority[100];
cout << "Please enter all information in minutes unless specified\n";
for (int i=0; i<=6; i++)
{
if (i==2)
{
float SleepH;
float SleepM;
cout << NumActivities[2][0];
cin >> SleepH >> SleepM;
cin.clear();
float F;
F = SleepM/60;
float total;
total= SleepH +F;
NormalSleep = total;
}
else if (i==5)
{
float SH;
float SM;
float com;
cout << NumActivities[5][0];
cin >> SH >> SM;
cout << NumActivities[5][1];
cin >> com;
if ((SH==0) && (SM==0) && (com))
{
continue;
}
float SF;
SF=SM/60;
float SchoolTime;
SchoolTime=SH+SF;
float ComTotal;
ComTotal=com * 2;
float ComDiv;
ComDiv=ComTotal/60;
float Total;
Total=SchoolTime+ComDiv;
float TotalDiv;
TotalDiv=Total/60;
NormalSchool=TotalDiv;
}
else if (i>5)
{
for (int f=0; f<A; f++)
{
int TPri;
TPri=i-6;
cout << NumActivities[6][0];
cin >> Name[i];
cout << NumActivities[6][1];
cin >> priority[TPri];
}
}
else
{
cout << NumActivities[i][0];
cin >> Time[i];
cout << NumActivities[i][1];
cin >> Amount[i];
float AcT;
AcT= Time[i]*Amount[i];
float Hours;
Hours = AcT/60;
Normal=Normal+Hours;
}
}
float NormalAdd;
NormalAdd=Normal+NormalSchool+NormalSleep;
int NormalND;
NormalND=NormalAdd;
float NormalDec;
NormalDec = NormalAdd-NormalND;
int NormalTime;
NormalTime=NormalDec*60;
cout <<NormalND<<" hours and "<<NormalTime<< " minutes\n";
float FACTime[50];
float Left;
Left=24-Normal;
float Alloc;
Alloc=Left/A;
float Allpri110;
Allpri110=Alloc*5;
float Allpri29;
Allpri29=Alloc*4;
float Allpri38;
Allpri38=Alloc*3;
float Allpri47;
Allpri47=Alloc*2;
float Allpri6;
Allpri6=Alloc*1.2;
for (int i=0; i<=A; i++)
{
if (priority[i]==1)
{
FACTime[i]=Alloc-Allpri110;
}
if (priority[i]==2)
{
FACTime[i]=Alloc-Allpri29;
}
if (priority[i]==3)
{
FACTime[i]=Alloc-Allpri38;
}
if (priority[i]==4)
{
FACTime[i]=Alloc-Allpri47;
}
if (priority[i]==5)
{
FACTime[i]=Alloc;
}
if (priority[i]==6)
{
FACTime[i]=Alloc+Allpri6;
}
if (priority[i]==7)
{
FACTime[i]=Alloc+Allpri47;
}
if (priority[i]==8)
{
FACTime[i]=Alloc+Allpri38;
}
if (priority[i]==9)
{
FACTime[i]=Alloc+Allpri29;
}
if (priority[i]==10)
{
FACTime[i]=Alloc+Allpri110;
}
}
int FTimeND;
FTimeND = FACTime[2];
float FTimeDec;
FTimeDec = FACTime[2]-FTimeND;
int FTime;
FTime = FTimeDec*60;
cout <<FTimeND<<" hours and "<<FTime<< " minutes\n";
return 0;
}
int main()
{
bodyProgram();
return 0;
}
|