473,326 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Student Name Class

I am new to C++ and in need of assistance with this program.
I can not get this program to display "Name for student1 is unassigned and ssn is 999999999" and to display next "Name for student2 is John Doe and ssn is 123456789". Thank you, for your help.

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. class Student
  9. {
  10.     private:
  11.  
  12.         char name[80]; // Student Name
  13.         int SSN;      // Social Sercurity Number (SNN)
  14.  
  15.     public:    
  16.  
  17.         student();
  18.         student(char name[80],int SNN);
  19.         void setstudent(char name[80]= unassigned,int SNN = 999999999); 
  20.         int setSSN;     // should not accept 1 argument and update
  21.         int getSSN();  // getSSN should return the class SSN
  22.         void char setname();
  23.         void char getname();
  24.         void display();
  25. };
  26.  
  27. Student :: Student()
  28. {
  29.     Name = "Unassigned"; // A Default constructor
  30.     SSN = 999999999;    // A Default constructor
  31.  
  32. }
  33.  
  34. Student :: Student(char Name[80],int SSN) 
  35. {
  36.     Name = "John Doe"; // Student Name
  37.     SSN = 123456789;   // // Social Sercurity Number (SNN)
  38.  
  39. }
  40.  
  41. char Student :: getname()
  42. {
  43.     return name;
  44. }
  45.  
  46. int Student :: getSSN()
  47. {
  48.     return SSN;
  49. }
  50.  
  51. void Student :: display ()
  52. {
  53.  
  54.     cout<<"Name for Student 1 is"<<name1<<"and"<<SSN1<<endl;
  55.     cout<<"Name for Student 2 is"<<name2<<"and"<<SSN2<<endl;
  56.  
  57. }
  58.  
  59. int main ()
  60. {
  61.  
  62.     int SSN1,SSN2;
  63.     char name1, name2;
  64.     display();
  65.  
  66.     return 0;
  67. }
Sep 22 '15 #1
2 1722
weaknessforcats
9,208 Expert Mod 8TB
There are many things not correct in your class design, but that's a topic for a later day.

The main thing I see is that a student object is never created in main() so nothing ever executes.

Plus main() has a display function that has no code.

Post again if you are still stuck.
Sep 22 '15 #2
weaknessforcats,

Thank you for your help.
Sep 23 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Daniel Lipovetsky | last post by:
I would like for an object to "report" to a container object when a new instance is created or deleted. I could have a container object that is called when a new instance is created, as below. ...
9
by: pnayak | last post by:
Hi, I am trying to write an intrusive List template class that accepts any type that is derived from a class called Link. I've derived a class called Student from Link to experiment. When I use...
4
by: lafayettejohnson | last post by:
there are 3 files but the one iam having problems with is the student.cpp student.cpp #include <iostream> // for ostream << and istream >> #include <string> #include "student.h"...
1
by: fareednn | last post by:
path is in which error is shown xampp is installed in d drive in my system Undefined variable: name in D:\xampp\htdocs\phonereporting\application\views\scripts\student\StudentFormVS.phtml on line 59...
2
by: Dee Filipski | last post by:
I wanted to create a search for student name by last & first. How do you do this. Also some students have an eñe or accents on their names. What is the best way to do this?
2
Exequiel
by: Exequiel | last post by:
Hello friends. . ! I want to know if how to get the name, class or id of a textfield in a form if we used the serialize() function in javascript. . example: we have this form <form...
3
by: blewie07 | last post by:
Create a class named Student. A student has fields for an ID number, number of credit hours earned, and number of points earned. (For example, many schools compute grade point averages based on a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.