دالة للبحث عن بيانات شخص محدد داخل السجلات بلغة سي بلس بلس
#include <iostream> #include <iomanip> #include <string> int main() { // student 1 std::string name1; char grade1; int age1; // student 2 std::string name2; char grade2; int age2; // student 3 std::string name3; char grade3; int age3; // student 4 std::string name4; char grade4; int age4; // student 1 std::cout << "Enter the first student's name: "; std::getline(std::cin, name1); // get the whole line std::cout << "Enter the first student's grade: "; std::cin >> grade1; std::cout << "Enter the first student's age: "; std::cin >> age1; std::cin.ignore(32767, '\n'); // skip to the next newline // student