Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2003 03:48 PM
02-24-2003 03:48 PM
C++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2003 03:50 PM
02-24-2003 03:50 PM
Re: C++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2003 03:56 PM
02-24-2003 03:56 PM
Re: C++
I am trying to make a structure for student data, look at the //comments. then i need to enter data for this student and pass it to this structure. but when the y enter in the state it needs to validate the state from its function. (only CA, WY, TX, AZ, TN are the valid states, if valid print 0, if any other state is entered print 1, as error.. Ive been stuck on this for about 2 hrs trying to figure this out. please look :)
#include
#include
#include
using namespace std;
//struct student // this is my struc but it wont let me pass info.
//{
char fName;
char lName;
int iDnumber;
int iCredits;
int Tuition;
char Resident;
char state[3];
//};
int main()
{
int const Res_Cred = 250;
int const Max_Of_Res = 3350;
int const Non_Res_Cred = 450;
int const Max_Of_Nonres = 6000;
cout <<"Enter students First Name: ";
cin >> fName;
cin.ignore( 10000, '\n');
cout <<"Enter students Last Name: ";
cin >> lName;
cin.ignore( 10000, '\n');
cout << "Enter school id number: ";
cin >> iDnumber;
cin.ignore( 10000, '\n');
cout << "How many credits are you taking: ";
cin >> iCredits;
cin.ignore( 10000, '\n');
cout << "What state are you from example: CA: ";
cin >> state;
cin.ignore( 10000, '\n');
cout << "Are you a resident? (Y/N)";
cin >> Resident;
cin.ignore( 10000, '\n');
if ((Resident == 'Y') || (Resident == 'y'))
{
Tuition = iCredits * Res_Cred;
cout << "They are a Resident" <
else
{
Tuition = iCredits * Non_Res_Cred;
cout << "They are Non Resident" <
if((iCredits < 0) || (iCredits >20))
cout << "ERROR: STUDENTS DATA IS OUT OF RANGE"<
if (Tuition < Max_Of_Res)
cout << "They are a Part time Student" <
cout << "They are a Full Time Student" <
cout << setw(5) << "ID"
<< setw(12)<< "Credits" << endl
<< setw(5) << "...."
<< setw(12)<< "......." << endl
<< setw(5) << iDnumber
<< setw(9) << iCredits << endl;
return 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2003 05:56 AM
02-25-2003 05:56 AM
Re: C++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2003 06:03 AM
02-25-2003 06:03 AM
Re: C++
You've defined your data structure, but have not declared any variables of that data type. You need to create a student, eg
int const Max_Of_Nonres = 6000;
struct student fred;
Or perhaps an array of students:
struct student students[50];
Once you've done that, to access a variable within the structure you need to use the dot notation, eg:
students[n].iDnumber = 44;
Regards
John