#include <iostream> #include <cstring> using namespace std; struct node { char name; char age; char coursenum; char grade; node *next; }; node* search(node* head) { node *temp=head; while (temp!=NULL) { if(strcmp(head->grade, grade)=="A") { cout << name; return name; } temp = temp-> next; } } int main() { node *head = NULL; char name; char age; char coursenum; char grade; int i=0; while (i<5) { cout << "Enter the students name: "; cin >> name; cout << "Enter the studens age: "; cin >> age; cout << "Enther the students course number: "; cin >> coursenum; cout<< "Enter the students grade: "; cin >> grade; node *temp = new node; temp->grade = grade; temp-> next = head; head = temp; i++; } search(head); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)