DABRiXPERT

VSEPR_v1.1.5_210323

Mar 22nd, 2021 (edited)
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.42 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     system("clear");
  6.     cout<<"\n混成(VSEPR)計算器\n版本 1.1.5\n發布日期 110(2021)年03月23日\n由 BRiXPERT團隊 隨便亂製作\n\n註:\n使用時請將氫原子(H)視為7A族元素,否則會出現計算錯誤;\n由於中心原子只有在4A~7A間才會滿足八隅體,所以只要中心原子為1A~3A時,π鍵為0。\n\n";
  7.     for(;;)
  8.     {
  9.         int in_A;
  10.         int in_B;
  11.         int a;
  12.         int b;
  13.         int e;
  14.         float lp,pi;
  15.         int sigma;
  16.         cout<<"A原子族數(限A族): ";
  17.         cin>>in_A;
  18.         cout<<"A原子數量: ";
  19.         cin>>a;
  20.         cout<<"B原子族數(限A族): ";
  21.         cin>>in_B;
  22.         cout<<"B原子數量: ";
  23.         cin>>b;
  24.         cout<<"電子數: ";
  25.         cin>>e;
  26.         // ----
  27.         float tmpA, tmpB, n;
  28.         if(a >= b)
  29.             sigma = a;
  30.         else
  31.             sigma = b;
  32.         if(sigma <= 1)
  33.             sigma = 2;
  34.         if(a == 1)
  35.         {
  36.             tmpA = in_A;
  37.             tmpB = in_B;
  38.             n = b;
  39.         }
  40.         else
  41.         {
  42.             tmpA = in_B;
  43.             tmpB = in_A;
  44.             n = a;
  45.         }
  46.         lp = ((tmpA+e)-((8-tmpB) * n))/2;
  47.         if(tmpA >= 4)
  48.             pi = 4-sigma-lp;
  49.         else
  50.             pi = 0;
  51.         cout<<"\n結果: ("<<sigma<<","<<lp<<")"<<pi<<"\n\n";
  52.     }
  53.     return 0;
  54. }
  55.  
Add Comment
Please, Sign In to add comment