Advertisement
kk258966

進階程式設計 12/26 練習四

Dec 26th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. //主程式
  7. int main()
  8. {
  9.     bool r1,r2;    //變數宣告
  10.    
  11.     //關係運算子
  12.    
  13.     r1 = ((5 == 5)&&(3>6)); //false(true && false)
  14.     r2 = ((5 == 5)||(3>6)); //true(true || false)
  15.    
  16.     cout << "((5 == 5)&&(3>6)) = " << r1 << "\n";
  17.     cout << "((5 == 5)||(3>6)) = " << r2 << "\n";
  18.        
  19.     int i;
  20.     float f =3.1415;
  21.     cout << "f = "<< f << "\n";
  22.    
  23.     i = (int) f;
  24.     cout << "i = " << i << "\n";
  25.        
  26.   system("PAUSE");
  27.   return 0;  
  28.    
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement