Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here



I got stuck in this program.  I need to be able to access the program after the password is correct.  Then I have to put in several student's name, student's id and their grades.  I have to calculate their average grade earned. (Each students have few differents grades.)

#include <iostream.h >
#include <iomanip.h >
#include <string.h >
//#include <ctype>
#include <ctype.h>
#include <stdlib.h>
//using namespace std;

class Password    // class declaration
Password() { bRetVal = 0;}
Password(char* szPassPhase){
length = strlen(szPassPhase);
szPassword = new char[length+1];
strcpy(szPassword , szPassPhase );
int check(void);
void setPassword(char*);
int HasUpperCase(void);   //check  for password
int HasLowercase(void);
int HasDigit(void);
char* szPassword;
int length;
int bRetVal;


void Password::setPassword(char* string) {
cout << szPassword << endl;

int Password :: check(){

while(bRetVal != 0){
if( (HasLowercase())  &&
(HasUpperCase())  &&
(HasDigit())      &&
(length >= 6))

cout<<"Your password is correct. Please process "<<endl;
if(!bRetVal) {
cout<< "Your password is incorrect.  exit and try again. "<<endl
<< "Your password should be at least six characters long, "<<endl
<< "and the password should contain at least one uppercase and at least one lower case letter. "<<endl
<< "An example of the password is B12c34 "<<endl;
  return bRetVal;


int Password::HasLowercase(){
 bRetVal =0;
 for(int x=0;x < length; x++)
if(islower((int)szPassword[x]))  //return a non-zero value if true
bRetVal = 1;
 return bRetVal;

int Password::HasUpperCase() {
bRetVal = 0;
for(int x=0; x<length;x++)//returns a no-zero
bRetVal = 1;
return bRetVal;

int Password::HasDigit() {
bRetVal =0;
for (int x=0;x<=length;x++)
if(isdigit((int)szPassword[x]))  {
bRetVal = 1;
return bRetVal;

struct Student
  char name[20];
  int idnum[10];
  int testGrade[];
void populate(Student *);
void possesInfo(Student *);
void display (Student *);

int main() {
char* string =" ";
Password a = Password(string) ;
cout<<"Type in your password: ";
cin.getline(string, 10);
cout<<"the password is: " <<string<< endl;
return 0;

void populate(Student *record)
  cout<< "\nenter student information: ";
  cout<< "\nStudent's name ";
  cin.getline(record->name, 10);
  cout<< "\nEnter the student's id unmber: ";
  cout<< "\nEnter The test grade ";


void prossesInfo(Student *record)
int count;
   float total, num, average;
cout << "Enter the name of the student: "
cin.getline((record->name, 10);

for ( count = 0; count < record->testGrade; count++)
count <<"Enter a grade of this student: ";

can you help?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close