#include #include #include using namespace std; int main() { ifstream elf; elf.open("new.txt"); if (elf.fail()) { cout << "Can't open the file\n"; exit(1); } cout << "Enter an element's symbol: "; string wanted; cin >> wanted; bool found = false; while (true) { string symbol, name; int atno; double atwt; elf >> symbol >> name >> atno >> atwt; if (elf.fail()) break; if (symbol == wanted) { cout << "Symbol: " << symbol << "\n"; cout << "Name " << name << "\n"; cout << "atomic number: " << atno << "\n"; cout << "atomic weight: " << atwt<< "\n"; found = true; } } if (found == false) cout << "Symbol " << wanted << " was not found\n"; elf.close(); }