two error come of (strcpy was not declare in this scope)
would any one show me, hw to remove this error, ... plz

                    Project Title: Student Record & Registration using Linked list

Description: This project is a Linked List application. If you would like to refresh you knowledge about linked list, you may read this article: Linked List. The project considers an engineering university having three departments: Electrical, Mechanical and Comptuer System Engineering(CSE). The university considers Metric(O-level) , FSc(A-level) and entry test marks for registering a student and calculate an aggregate based on a specific criteria. The project finds in which dept. a student should be registered and store its record(temporarily) using linked list. Note that this Linked list implementation just serves as a starting point. You may modify it (like adding other departments in the university and changing admission criteria) or extend it (for instance, writing the student records to a text file for later retrievel).

#include<iostream>
#include<conio.h>
#include<string>
#include<stdlib.h>  //-->library for malloc & realloc...
using namespace std;

bool register_student(struct student *stud,struct list *ls);
double calculate_aggregiate(struct student *);
void addToList(struct student *stud, struct list *l);
void showList(struct student *stud, struct list *l);

struct student
{
    char name[20];
    int metric_marks, fsc_marks, entryTest_marks;
    student *next;
    //--> 10 % weightage to metric, 50% to fsc, 40% to entry test...

};

struct list
{
    char name[20];
    double aggr;
    list *next;

};


int main()
{   
    student *s;     //--> creates an object of student...
    s = (struct student *) malloc(sizeof(struct student));

    struct list *ls;
    ls = (struct list *) malloc(sizeof(struct list));
    strcpy(ls->name, "");
    ls->aggr = 0;
    ls->next= NULL;
    do
    {
    cout<<"Write 1 to register a new student\n";
    cout<<"Write 2 to display lists of students registered\n";
    cout<<"Write 3 to quit\n";

    int input;
    cin>>input;
    if (input == 1)
    {
        register_student(s, ls);

    }
    else if (input == 2)
    {
        showList(s, ls);
    }
    else if (input == 3)
        exit(0);
    cout<<"\n";
    } while(1);

    getch();
}

bool register_student(struct student *stud,struct list *ls)
{   
    student *s = stud;
    cout<<"Write name of student\n";
    cin>>s->name;
    cout<<"Enter metric percentage\n";
    cin>>s->metric_marks;
    cout<<"Enter fsc percentage\n";
    cin>>s->fsc_marks;
    cout<<"Enter entry test percentage\n";
    cin>>s->entryTest_marks;

    double aggregiate;
    aggregiate = calculate_aggregiate(s);   //-->call to function below...
    cout<<"aggregiate percentage is "<< aggregiate<<"\n";
    if (aggregiate >= 70)
    {
        cout<<"Student registered in Electrical\n";
        addToList(s,ls);
        return true;
    }
    else if (aggregiate >= 60)
    {
        cout<<"Student registered in Mechanical\n";
        addToList(s,ls);
        return true;
    }
    else if (aggregiate >=50)
    {
        cout<<"Student registered in CSE\n";
        addToList(s,ls);
        return true;
    }
    else
    {
        cout<<"Sorry, the student can't be registered in engineering\n";
        return false;
    }

}

double calculate_aggregiate(struct student *stud)
{   
    student *s = stud;
    double aggr;
    aggr = s->metric_marks * 10/100  + s->fsc_marks * 50/100 + 
        s->entryTest_marks * 40/100;

    return aggr;

}


void addToList(struct student *stud, struct list *l)
{   
    list *pointer = l;
    while (pointer->next != NULL)
    {
        pointer = pointer->next;
    } 
    pointer->next = (struct list *) malloc(sizeof(struct list));
    pointer = pointer->next;
    strcpy(pointer->name , stud->name);
    pointer->aggr = calculate_aggregiate(stud);
    pointer->next = NULL;


}

void showList(struct student *stud, struct list *l)
{
    list *pointer = l;
    if (pointer->next == NULL)
        cout<<"No student registered yet!\n";
    else
    {
        cout<<"Students statistics are: \n";
        while (pointer->next != NULL)
        {
            pointer = pointer->next;
            cout<<"Name of student is: "<<pointer->name<<"\n";
            cout<<"Aggregiate of student is: "<<pointer->aggr<<"\n";
            if (pointer->aggr >= 70)
                cout<<"Student registered in Electrical\n";
            else if(pointer->aggr >=60)
                cout<<"Student registered in Mechanical\n";
            else
                cout<<"Student registered in CSE\n";
                cout<<"\n";
            }
        }
    }

Recommended Answers

I compiled your program with VC++ 2013 and only got one error, related to deprecated strcpy(). That error easily goes away by disabling error 4996

#pragma warning(disable: 4996)

line 37: strcpy(ls->name, "");

Why use strcpy() here? Just set the first character to 0. ls->name[0] …

Jump to Post

can i get it too?

Jump to Post

All 7 Replies

I compiled your program with VC++ 2013 and only got one error, related to deprecated strcpy(). That error easily goes away by disabling error 4996

#pragma warning(disable: 4996)

line 37: strcpy(ls->name, "");

Why use strcpy() here? Just set the first character to 0. ls->name[0] = '\0';

If this is supposed to be c++, why are you using so many C constructs and functions? For example you should use new instead of malloc(), and you could substitute std::string for char*.

Only write #include<string.h> instead of #include<string> error will be removed.

can i get this in python?

No one here is going to do your work for you. If you want it in Python you'll have to put in the work yourself.

can i get it too?

commented: It's free for the taking above as Ancient Dragon fixed it. +0

I'm trying to master the Python program now. I have some questions regarding functions. If I had more free time, I would deal with all this on my own. But I had to get a job and therefore I just can’t give that maximum attention.
How do you think is it possible to order the completion of this task in this fast cheap essays service? Thank you.
Any answers and suggestions appreciated.

commented: It's called cheating. And the scum who sell it should be in jail. -3
commented: "fast cheap essays" is not a job but a criminal enterprise. -3

This program is not displaying the "Student Statistics" and Name in the output.
Please solve this issue.
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.