Answers for "c++ projects for presentation with source cod e"

0

c++ projects for presentation with source cod e

/*
Author: https://www.cppbuzz.com
Date: 20th Jan 2018
For more projects please visit : https://www.cppbuzz.com
*/

#include <iostream>
#include <string>
#include <fstream>
#include <cstring>

using namespace std;

int adminView();
int studentView();
int studentLogin();
int checkCredentials(string userName, string password);
int getAllStudentsbyRollNo();
int deleteAllStudents();
int deleteStudentbyRollno();
int checkListOfStudentsRegistered();
int checkPresenseCountbyRollno();
int getListOfStudentsWithTheirPresenseCount();
int registerStudent();
int adminLogin();
int registerStudent();
int markMyAttendance(string username);
int countMyAttendance(string username);
int delay();

int delay()
{
for(int i = 0; i<3; i ++)
{
	cout<<"\n Saving Records ...";
    for(int ii = 0; ii<20000; ii ++)
    {
    	for(int iii = 0; iii<20000; iii ++)
       	{ }
    }
}
   
cout<<"\n Exiting Now ...";
for(int i = 0; i<3; i ++){
   for(int ii = 0; ii<20000; ii ++) { 
     for(int iii = 0; iii<20000; iii ++){
	 }
    } 
}

return 0;
}

int adminView()
{	
int goBack = 0;
while(1)
{
system("cls");
cout<<"\n 1 Register a Student";
cout<<"\n 2 Delete All students name registered";
cout<<"\n 3 Delete student by rollno";
cout<<"\n 4 Check List of Student registered by userame";
cout<<"\n 5 Check presense count of any student by Roll No";
cout<<"\n 6 Get List of student with their attendance count";
cout<<"\n 0. Go Back <- \n";
int choice;

cout<<"\n Enter you choice: ";
cin>>choice;

switch(choice)
{
	case 1: registerStudent();break;  
	case 2: deleteAllStudents(); break;
	case 3: deleteStudentbyRollno(); break;
	case 4: checkListOfStudentsRegistered(); break;
	case 5: checkPresenseCountbyRollno(); break;
	case 6: getListOfStudentsWithTheirPresenseCount(); break;
	case 0: goBack = 1;break;
    default: cout<<"\n Invalid choice. Enter again ";
    getchar();           	
}   

if(goBack == 1)
{
break; //break the loop
}     

}

return 0;
}

int studentLogin()
{
system("cls");
cout<<"\n -------- Student Login ---------";	
studentView();
delay();
return 0; 
}


int adminLogin()
{
system("cls");
cout<<"\n --------- Admin Login --------";	

string username;
string password;

cout<<"\n Enter username : ";
cin>>username;
cout<<"\n Enter password : ";
cin>>password;

if(username=="admin" && password=="admin@2") 
{
    adminView();
    getchar();	
    delay();
}   
else
{
cout<<"\n Error ! Invalid Credintials..";	
cout<<"\n Press any key for main menu ";
getchar();getchar();
}

return 0;
}


int checkStudentCredentials(string username, string password)
{
// read file line by line & check if username-password.dat exist?
// if it exsist return 1 else 0

ifstream read;
read.open("db.dat");

if (read) {
// The file exists, and is open for input
int recordFound = 0;
string line;
string temp = username + password + ".dat";
cout<<"\n file name is : "<<temp;
while(getline(read, line)) {
	if(line == temp)
	{
		recordFound = 1;
		break;
	}
}

if(recordFound == 0)
    return 0;
else
   return 1;
}
else
{
   return 0;
}
    		
}
Posted by: Guest on August-11-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language