This is what I have so far, I still need some help.
Student.h file: - #ifndef STUDENT_H
-
#define STUDENT_H
-
-
#include <iostream>
-
#include <string>
-
#include <cstdlib>
-
-
struct Name {
-
std::string firstName;
-
std::string lastName;
-
};
-
-
enum Year {
-
FRESHMAN = 1,
-
SOPHMORE,
-
JUNIOR,
-
SENIOR,
-
};
-
-
class Student
-
{
-
private:
-
Name name;
-
int idNumber;
-
std::string department;
-
Year year;
-
public:
-
Student(const std::string& student, int id_number, const std::string& department, Years);
-
Student(const std::string& student, int id_number);
-
Student();
-
-
int getidNumber();
-
std::string getName();
-
std::string getdepartment();
-
Year getYear();
-
-
void setName(const Name& student_name);
-
void setidNumber(int id_number);
-
void setdepartment(const std::string student_department);
-
void setyear(Year students_current_year);
-
};
-
-
#endif
Here is the error that Student.cpp is giving me: - Student.cpp:8:1: error: 'Student' does not name a type
-
Student::Student(const std::string& student, int id_number, const std::string& department, Year year)
-
^~~~~~~
-
Student.cpp:16:1: error: 'Student' does not name a type
-
Student::Student(const std::string& student, int id_number)
-
^~~~~~~
-
Student.cpp file: - #ifndef STUDENT_H
-
#define STUDENT_H
-
-
#include <string>
-
#include <cstdlib>
-
#include "Student.h"
-
-
Student::Student(const std::string& student, int id_number, const std::string& department, Year year)
-
{
-
Name name = setName();
-
idNumber = setidnumber();
-
department = setdepartment();
-
Year year = setyear();
-
};
-
-
Student::Student(const std::string& student, int id_number)
-
{
-
Name name = std::student;
-
idNumber = std::id_number;
-
};
-
-
#endif
hw3.cpp file: - #ifndef STUDENT_H
-
#define STUDENT_H
-
-
#include <iostream>
-
#include <string>
-
#include <cstdlib>
-
#include "Student.h"
-
#include "Student.cpp"
-
-
using namespace std;
-
-
int main()
-
{
-
Student::student()
-
-
void displayStudent(Student);
-
-
return 0;
-
}
-
-
#endif
Let me know where I'm making mistakes/lead/help me towards the right direction. Thanks so much!
3 1283
This code in class Student won't compile and that would be enough for the compiler to say Student is not a type. - public:
-
Student(const std::string& student, int id_number, const std::string& department, Years);
-
Look closely at the last argument of the constructor. All it says is Years. It needs a type. Like enum Year:
Try this: - public:
-
Student(const std::string& student, int id_number, const std::string& department, enum Year Years);
-
-
-
-
Post again if you are still stuck.
It's still throwing off numerous errors even with enum defined.
The number of errors is not important. Error 1 can cause Error 2,3,4,5,6, etc...
What you have to do is fix the first error only. Then recompile. If there are still errors, fix only the first one and recompile. You will eventually get them all.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Martien van Wanrooij |
last post by:
I am rather new at the classes concept in php so maybe I am overseeing
something very simple but anyway I tried the following code:
<?php
class Navbar
{
var $begin = "";
function Navbar($bBegin = "")
{
$this->begin = $bBegin;
$this->tussen = $bTussen;
|
by: John Smith |
last post by:
A friend's small business has gotten themselves in trouble.
Their only programmer has recently skipped the country and did not leave the
source code or any design notes for a couple of program modules. It appears
that he did all the work for those few modules on his own laptop and never
integrated them into Visual Source Safe.
What tools, if any, exist in the VB world to disassemble / reverse engineer
these modules?
|
by: JDevine |
last post by:
Hey. I posted a info about a program I have written that uses google
to get and download files by type and site. I need HELP!!! This
program is finished except for 2 features which, having tried for two
weeks to create I cannot. This is my first program EVER. I simply an
stuck. Please help. I was allowed by my employer to experiment with
programing / open source. I'd like to be able to deliver a complete
program, (so I can possibly...
|
by: Kingdom |
last post by:
In my data base I have a list of componet types e.g. type A - I have 8 off
- type B I have 12 off etc.
I'm using
Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM
Parts_Table")
to populate a drop down but would like to use several drop downs
restricting the contents of each drop down to the records pertaining to one
|
by: Tommy Lang |
last post by:
Hi !!
I am a c++ novice and I would appreciate any help with the following:
I have created a class called "Number". In the main function of my
program I call the class constructor twice like this(at start up)...
int main(){
Number no1;
Number no2;
.......
| |
by: Stephen |
last post by:
Im new to VB.net....Im having a problem understandign how a constructor relates to the base form and a class.
What is the function on the constructor ..does it accept variables passed to it from the form?
Steve
|
by: try2nd |
last post by:
I have console application where i can read line by line from a .txt file and
save it to a different file name in .txt format as well.
Here's the basic code:
using System.IO namespace
Dim fs As New FileStream(reportPath, FileMode.Open, FileAccess.Read)
Dim fs1 As New FileStream(writePath, FileMode.Create, FileAccess.Write)
Dim oReader As New StreamReader(fs)
Dim oWrite As New StreamWriter(fs1)
Dim sLine As String = ""
|
by: Raffi B. |
last post by:
I have a form named MainWindow in my project. Visual Studio C# Express
automatically creates MainWindow.Designer.cs and MainWindow.resx as partial
classes on MainWindow. I am trying to add a new C# class file named
MainWindow.EventHandlers.cs to the project as a partial class of MainWindow
using...
partial class MainWindow
{
}
|
by: KeithAL |
last post by:
I'm a student whose taking comp 110, and my professor gave the class a practice exam to help us study for our exam on tuesday.
The question is:
A perfect number is a positive integer that is equal to the sum of its proper divisors. A proper divisor is a positive integer other than the number itself that divides the number evenly (i.e., no remainder).
For example, six is a perfect number because the sum of its proper divisors 1,2, and 3...
|
by: irishwoman0980 |
last post by:
i am using access 2010 and needing it to open a word.docx so that the user can just add an address to it and be done. i have already created the template word.docx just need help linking the two together with a command button.
haven't done code in a very long time and cant remember how to.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |