Guest User

aw man

a guest
May 22nd, 2012
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int SchoolInt;
  9.     cout << "Number of Schools: ";
  10.     cin >> SchoolInt;
  11.     double Schools [SchoolInt];
  12.     for(int a = 1; a <= SchoolInt; a++)
  13.         {
  14.             double Students;
  15.             cout << "Number of Students in School " << a << ": ";
  16.             cin >> Students;
  17.             Schools[a] = Students;
  18.         }
  19.     for(int a = 1; a <= SchoolInt; a++)
  20.     {
  21.         cout << "School " << Schools[a] << ": ";
  22.         if(Schools[a] == 2)
  23.         {
  24.             cout << "School " << a << " will not be able to enter.\n";
  25.         }
  26.         if(Schools[a] >= 3 && Schools[a]%3)
  27.             {
  28.             if(Schools[a]/(-a+4) >= 2)
  29.             {
  30.                 cout << "School " << Schools[a] << " - " << floor(Schools[a]/(-a+4)) << " teams of 3.";
  31.                 Schools[a] = floor(Schools[a]/(-a+4));
  32.             }
  33.             else if(Schools[a]/(-a+4) < 2)
  34.             {
  35.                 cout << "School " << Schools[a] << " - " << floor(Schools[a]/(-a+4)) << " team of 3.";
  36.                 Schools[a] = floor(Schools[a]/(-a+4));
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment