Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CS283
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Charles Barnwell
CS283
Commits
6f09840f
Commit
6f09840f
authored
3 months ago
by
Charles Barnwell
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
8de727c4
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
2-StudentDB/db.h
+35
-0
35 additions, 0 deletions
2-StudentDB/db.h
with
35 additions
and
0 deletions
2-StudentDB/db.h
0 → 100644
+
35
−
0
View file @
6f09840f
#ifndef __DB_H__
#define __DB_H__
// Basic student database record. Note:
// 1. id must be > 0. A student id==0 means the record has been deleted
// 2. gpa is an int, should be between 0<=gpa<=500, real gpa is gpa/100.0 this
// simplifies dealing with floating point types
// 3. Notice that the student struct was engineered to have a size of
// 64 bytes. There are reasons for using such a number
typedef
struct
student
{
int
id
;
char
fname
[
24
];
char
lname
[
32
];
int
gpa
;
}
student_t
;
//Define limits for sudent ids and allowable GPA ranges. Note GPA values will
//be stored as integers but printed as floats. For example a GPA of 450 is really
//that value divided by 100.0 or 4.50.
#define MIN_STD_ID 1
#define MAX_STD_ID 100000
#define MIN_STD_GPA 0
#define MAX_STD_GPA 500
//some useful constants you should consider using versus hard coding
//in your program.
static
const
student_t
EMPTY_STUDENT_RECORD
=
{
0
};
static
const
int
STUDENT_RECORD_SIZE
=
sizeof
(
struct
student
);
static
const
int
DELETED_STUDENT_ID
=
0
;
#define DB_FILE "student.db" //name of database file
#define TMP_DB_FILE ".tmp_student.db" //for extra credit
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment