fork download
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. struct suhu{
  6. string lokasi;
  7. double c;
  8. double f;
  9. double k;
  10. string kategori;
  11. };
  12.  
  13. int main()
  14. {
  15. cout << endl << " Menghitung Suhu Suatu Lokasi" << endl << " Mareeq Prayata Setiawan - 25/557766/PA/23437 - ELA" << endl << endl;
  16.  
  17. suhu a;
  18.  
  19. cout << endl << " Lokasi Sensor = ";
  20. getline(cin, a.lokasi);
  21.  
  22. cout << " Suhu (Celcius) = ";
  23. cin >> a.c;
  24.  
  25. a.f = (a.c*9/5) + 32;
  26. a.k = a.c +273.15;
  27.  
  28. if ( a.c>30)
  29. a.kategori = "Fanashhh";
  30. else if ( a.c >=20 and a.c <=30)
  31. a.kategori = "adem lah mayan";
  32. else
  33. a.kategori = "brrrrrrrrrrrr";
  34.  
  35. cout << endl << " Lokasi Sensor = " << a.lokasi << endl;
  36. cout << " Suhu Celcius = " << a.c << endl;
  37. cout << " Suhu Fahrenheit = " << a.f << endl;
  38. cout << " Suhu Kevin = " << a.k << endl;
  39. cout << " Kategori = " << a.kategori << endl;
  40.  
  41. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
         Menghitung Suhu Suatu Lokasi
 Mareeq Prayata Setiawan - 25/557766/PA/23437 - ELA


 Lokasi Sensor =  Suhu (Celcius) = 
 Lokasi Sensor   = 
 Suhu Celcius    = 4.94066e-324
 Suhu Fahrenheit = 32
 Suhu Kevin      = 273.15
 Kategori        = brrrrrrrrrrrr