123456789101112131415161718192021222324252627282930
// Chapter 6 exercise 6 #include <iostream> #include <string> struct contribs { std::string name; double donation; }; int main() { using namespace std; int contributors; cout << "Enter the number of contributors: "; cin >> contributors; contribs *donors = new contribs[contributors]; for (int i = 0; i < contributors; i++) { cout << "Please enter contributors name: "; cin >> donors[i].name; cout << "Enter contributors donation amount: $"; cin >> donors[i].donation; } delete [] donors; return 0; }
getline(cin,donors[i].name);
getline( std::cin, doners[i].name );