Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. bool isHydroxide(char compound[])
  4. {
  5.     char char1;
  6.     char char2;
  7.     for (int i = 1; compound[i] != 0; i++)
  8.     {
  9.         char1 = compound[i - 1];
  10.         char2 = compound[i];
  11.     }
  12.     return (char1 == 'O' && char2 == 'H');
  13. }
  14.  
  15. int main()
  16. {
  17.     char compound[81];
  18.     std::cout << "Introduza o composto.";
  19.     std::cin >> compound;
  20.     if (isHydroxide(compound))
  21.         std::cout << "fixe";
  22.     else
  23.         std::cout << "notfixe";
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement