Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- bool isHydroxide(string compound)
- {
- if (compound.substr(compound.length() - 2) == "OH")
- return true;
- else
- return false;
- }
- int main()
- {
- string compound;
- cout << "Insira um composto quimico: ";
- cin >> compound;
- if (isHydroxide(compound))
- cout << "E um hidroxido." << endl;
- else
- cout << "Nao e um hidroxido." << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement