SlideShare a Scribd company logo
1 of 3
Download to read offline
Below is a Password Management Program
#include <stdio.h>
#include <string.h>
#define MAX_USERS 100
struct user {
char username[20];
char password[20];
char codeword[20];
};
int num_users = 0;
struct user users[MAX_USERS];
int find_user_index(char *username) {
for (int i = 0; i < num_users; i++) {
if (strcmp(users[i].username, username) == 0) {
return i;
}
}
return -1;
}
void add_user() {
if (num_users == MAX_USERS) {
printf("Error: maximum number of users reachedn");
return;
}
struct user u;
printf("Enter username: ");
scanf("%s", u.username);
printf("Enter password: ");
scanf("%s", u.password);
printf("Enter codeword: ");
scanf("%s", u.codeword);
users[num_users++] = u;
}
void edit_user() {
char username[20];
printf("Enter username to edit: ");
scanf("%s", username);
int i = find_user_index(username);
if (i == -1) {
printf("Error: user not foundn");
return;
}
struct user u = users[i];
printf("Enter new password (or press enter to keep current password): ");
scanf("%s", u.password);
printf("Enter new codeword (or press enter to keep current codeword): ");
scanf("%s", u.codeword);
users[i] = u;
}
void display_users() {
printf("%-20s %-20s %-20sn", "Username", "Password", "Codeword");
for (int i = 0; i < num_users; i++) {
printf("%-20s %-20s %-20sn", users[i].username, users[i].password, users[i].codeword);
}
}
void remove_user() {
char username[20];
printf("Enter username to remove: ");
scanf("%s", username);
int i = find_user_index(username);
if (i == -1) {
printf("Error: user not foundn");
return;
}
for (int j = i; j < num_users - 1; j++) {
users[j] = users[j + 1];
}
num_users--;
}
int main() {
int choice;
while (1) {
printf("n");
printf("1. Add usern");
printf("2. Edit usern");
printf("3. Display usersn");
printf("4. Remove usern");
printf("5. Exitn");
printf("Enter choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
add_user();
break;
case 2:
edit_user();
break;
case 3:
display_users();
break;
case 4:
remove_user();
break;
case 5:
return 0;
default:
printf("Error: invalid choicen");
}
}
}
Test and Debug the above program

More Related Content

Similar to Below is a Password Management Program incl.pdf

Assignment no39
Assignment no39Assignment no39
Assignment no39Jay Patel
 
from datetime import datetime def CreateUsers()- print('##### Crea.pdf
from datetime import datetime def CreateUsers()-     print('##### Crea.pdffrom datetime import datetime def CreateUsers()-     print('##### Crea.pdf
from datetime import datetime def CreateUsers()- print('##### Crea.pdfatozworkwear
 
Mozilla とブラウザゲーム
Mozilla とブラウザゲームMozilla とブラウザゲーム
Mozilla とブラウザゲームNoritada Shimizu
 
Creating a Whatsapp Clone - Part XIII - Transcript.pdf
Creating a Whatsapp Clone - Part XIII - Transcript.pdfCreating a Whatsapp Clone - Part XIII - Transcript.pdf
Creating a Whatsapp Clone - Part XIII - Transcript.pdfShaiAlmog1
 
Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»e-Legion
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservationSwarup Kumar Boro
 
Railway reservation
Railway reservationRailway reservation
Railway reservationSwarup Boro
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical fileMitul Patel
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answersQuratulain Naqvi
 
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdfUsing standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdffashiongallery1
 
STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING Gurwinderkaur45
 
Programming Fundamentals Arrays and Strings
Programming Fundamentals   Arrays and Strings Programming Fundamentals   Arrays and Strings
Programming Fundamentals Arrays and Strings imtiazalijoono
 
Basic C Programming Lab Practice
Basic C Programming Lab PracticeBasic C Programming Lab Practice
Basic C Programming Lab PracticeMahmud Hasan Tanvir
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st StudyChris Ohk
 
RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”apostlion
 

Similar to Below is a Password Management Program incl.pdf (20)

Assignment no39
Assignment no39Assignment no39
Assignment no39
 
Ccc
CccCcc
Ccc
 
Railwaynew
RailwaynewRailwaynew
Railwaynew
 
from datetime import datetime def CreateUsers()- print('##### Crea.pdf
from datetime import datetime def CreateUsers()-     print('##### Crea.pdffrom datetime import datetime def CreateUsers()-     print('##### Crea.pdf
from datetime import datetime def CreateUsers()- print('##### Crea.pdf
 
C programming
C programmingC programming
C programming
 
Mozilla とブラウザゲーム
Mozilla とブラウザゲームMozilla とブラウザゲーム
Mozilla とブラウザゲーム
 
Creating a Whatsapp Clone - Part XIII - Transcript.pdf
Creating a Whatsapp Clone - Part XIII - Transcript.pdfCreating a Whatsapp Clone - Part XIII - Transcript.pdf
Creating a Whatsapp Clone - Part XIII - Transcript.pdf
 
Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»Юрий Буянов «Squeryl — ORM с человеческим лицом»
Юрий Буянов «Squeryl — ORM с человеческим лицом»
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservation
 
Railway reservation
Railway reservationRailway reservation
Railway reservation
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
 
Useful c programs
Useful c programsUseful c programs
Useful c programs
 
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdfUsing standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
 
STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING
 
Programming Fundamentals Arrays and Strings
Programming Fundamentals   Arrays and Strings Programming Fundamentals   Arrays and Strings
Programming Fundamentals Arrays and Strings
 
Basic C Programming Lab Practice
Basic C Programming Lab PracticeBasic C Programming Lab Practice
Basic C Programming Lab Practice
 
Programming egs
Programming egs Programming egs
Programming egs
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
 
RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”
 

More from abiagencymadurai

ALGORITHM SequentialSearch2 A0nK IImplements sequenti.pdf
ALGORITHM SequentialSearch2 A0nK IImplements sequenti.pdfALGORITHM SequentialSearch2 A0nK IImplements sequenti.pdf
ALGORITHM SequentialSearch2 A0nK IImplements sequenti.pdfabiagencymadurai
 
El gasto en atencin mdica como porcentaje del PIB est aum.pdf
El gasto en atencin mdica como porcentaje del PIB est aum.pdfEl gasto en atencin mdica como porcentaje del PIB est aum.pdf
El gasto en atencin mdica como porcentaje del PIB est aum.pdfabiagencymadurai
 
45 Kresel para sistemi 1971deki OPEC petrol krizi ve 1970.pdf
45 Kresel para sistemi 1971deki OPEC petrol krizi ve 1970.pdf45 Kresel para sistemi 1971deki OPEC petrol krizi ve 1970.pdf
45 Kresel para sistemi 1971deki OPEC petrol krizi ve 1970.pdfabiagencymadurai
 
Alrededor del 9 de las personas son zurdas Suponga que se .pdf
Alrededor del 9 de las personas son zurdas Suponga que se .pdfAlrededor del 9 de las personas son zurdas Suponga que se .pdf
Alrededor del 9 de las personas son zurdas Suponga que se .pdfabiagencymadurai
 
begintabularcc hline Component amp Structure to Fun.pdf
begintabularcc hline Component amp Structure to Fun.pdfbegintabularcc hline Component amp Structure to Fun.pdf
begintabularcc hline Component amp Structure to Fun.pdfabiagencymadurai
 
After watching the video Supreme Court of the United States .pdf
After watching the video Supreme Court of the United States .pdfAfter watching the video Supreme Court of the United States .pdf
After watching the video Supreme Court of the United States .pdfabiagencymadurai
 
2 Which of the following is a structural characteristic of .pdf
2 Which of the following is a structural characteristic of .pdf2 Which of the following is a structural characteristic of .pdf
2 Which of the following is a structural characteristic of .pdfabiagencymadurai
 
Leonard ve Carl bir ev gelitirme maazasnda yneticidir Leo.pdf
Leonard ve Carl bir ev gelitirme maazasnda yneticidir Leo.pdfLeonard ve Carl bir ev gelitirme maazasnda yneticidir Leo.pdf
Leonard ve Carl bir ev gelitirme maazasnda yneticidir Leo.pdfabiagencymadurai
 
Can I get this information in a condensed version 1 Human .pdf
Can I get this information in a condensed version 1 Human .pdfCan I get this information in a condensed version 1 Human .pdf
Can I get this information in a condensed version 1 Human .pdfabiagencymadurai
 
Discussion 81 Competitive Advantage Describe how a an .pdf
Discussion 81  Competitive Advantage  Describe how a an .pdfDiscussion 81  Competitive Advantage  Describe how a an .pdf
Discussion 81 Competitive Advantage Describe how a an .pdfabiagencymadurai
 
A nurse is triaging clients in the emergency department whi.pdf
A nurse is triaging clients in the emergency department whi.pdfA nurse is triaging clients in the emergency department whi.pdf
A nurse is triaging clients in the emergency department whi.pdfabiagencymadurai
 
1what is the longest proteoform of DPM1 homo sapiens huma.pdf
1what is the longest proteoform of DPM1  homo sapiens huma.pdf1what is the longest proteoform of DPM1  homo sapiens huma.pdf
1what is the longest proteoform of DPM1 homo sapiens huma.pdfabiagencymadurai
 
Troubled Asset Relief Program TARP is a group of programs .pdf
Troubled Asset Relief Program TARP is a group of programs .pdfTroubled Asset Relief Program TARP is a group of programs .pdf
Troubled Asset Relief Program TARP is a group of programs .pdfabiagencymadurai
 
Cul de las siguientes tecnologas de energa alternativa r.pdf
Cul de las siguientes tecnologas de energa alternativa r.pdfCul de las siguientes tecnologas de energa alternativa r.pdf
Cul de las siguientes tecnologas de energa alternativa r.pdfabiagencymadurai
 
Como medio de pago las monedas tienen el gran inconveniente.pdf
Como medio de pago las monedas tienen el gran inconveniente.pdfComo medio de pago las monedas tienen el gran inconveniente.pdf
Como medio de pago las monedas tienen el gran inconveniente.pdfabiagencymadurai
 
4 Qualitatively describe the processes through which deep .pdf
4 Qualitatively describe the processes through which deep .pdf4 Qualitatively describe the processes through which deep .pdf
4 Qualitatively describe the processes through which deep .pdfabiagencymadurai
 
Rank the following from highest average historical return to.pdf
Rank the following from highest average historical return to.pdfRank the following from highest average historical return to.pdf
Rank the following from highest average historical return to.pdfabiagencymadurai
 
Wanda se queja con Jackie de que el uso de guiones la hace s.pdf
Wanda se queja con Jackie de que el uso de guiones la hace s.pdfWanda se queja con Jackie de que el uso de guiones la hace s.pdf
Wanda se queja con Jackie de que el uso de guiones la hace s.pdfabiagencymadurai
 
Why has natural selection favored the evolution of double ci.pdf
Why has natural selection favored the evolution of double ci.pdfWhy has natural selection favored the evolution of double ci.pdf
Why has natural selection favored the evolution of double ci.pdfabiagencymadurai
 
Which of the following is usually NOT true about turnkey inf.pdf
Which of the following is usually NOT true about turnkey inf.pdfWhich of the following is usually NOT true about turnkey inf.pdf
Which of the following is usually NOT true about turnkey inf.pdfabiagencymadurai
 

More from abiagencymadurai (20)

ALGORITHM SequentialSearch2 A0nK IImplements sequenti.pdf
ALGORITHM SequentialSearch2 A0nK IImplements sequenti.pdfALGORITHM SequentialSearch2 A0nK IImplements sequenti.pdf
ALGORITHM SequentialSearch2 A0nK IImplements sequenti.pdf
 
El gasto en atencin mdica como porcentaje del PIB est aum.pdf
El gasto en atencin mdica como porcentaje del PIB est aum.pdfEl gasto en atencin mdica como porcentaje del PIB est aum.pdf
El gasto en atencin mdica como porcentaje del PIB est aum.pdf
 
45 Kresel para sistemi 1971deki OPEC petrol krizi ve 1970.pdf
45 Kresel para sistemi 1971deki OPEC petrol krizi ve 1970.pdf45 Kresel para sistemi 1971deki OPEC petrol krizi ve 1970.pdf
45 Kresel para sistemi 1971deki OPEC petrol krizi ve 1970.pdf
 
Alrededor del 9 de las personas son zurdas Suponga que se .pdf
Alrededor del 9 de las personas son zurdas Suponga que se .pdfAlrededor del 9 de las personas son zurdas Suponga que se .pdf
Alrededor del 9 de las personas son zurdas Suponga que se .pdf
 
begintabularcc hline Component amp Structure to Fun.pdf
begintabularcc hline Component amp Structure to Fun.pdfbegintabularcc hline Component amp Structure to Fun.pdf
begintabularcc hline Component amp Structure to Fun.pdf
 
After watching the video Supreme Court of the United States .pdf
After watching the video Supreme Court of the United States .pdfAfter watching the video Supreme Court of the United States .pdf
After watching the video Supreme Court of the United States .pdf
 
2 Which of the following is a structural characteristic of .pdf
2 Which of the following is a structural characteristic of .pdf2 Which of the following is a structural characteristic of .pdf
2 Which of the following is a structural characteristic of .pdf
 
Leonard ve Carl bir ev gelitirme maazasnda yneticidir Leo.pdf
Leonard ve Carl bir ev gelitirme maazasnda yneticidir Leo.pdfLeonard ve Carl bir ev gelitirme maazasnda yneticidir Leo.pdf
Leonard ve Carl bir ev gelitirme maazasnda yneticidir Leo.pdf
 
Can I get this information in a condensed version 1 Human .pdf
Can I get this information in a condensed version 1 Human .pdfCan I get this information in a condensed version 1 Human .pdf
Can I get this information in a condensed version 1 Human .pdf
 
Discussion 81 Competitive Advantage Describe how a an .pdf
Discussion 81  Competitive Advantage  Describe how a an .pdfDiscussion 81  Competitive Advantage  Describe how a an .pdf
Discussion 81 Competitive Advantage Describe how a an .pdf
 
A nurse is triaging clients in the emergency department whi.pdf
A nurse is triaging clients in the emergency department whi.pdfA nurse is triaging clients in the emergency department whi.pdf
A nurse is triaging clients in the emergency department whi.pdf
 
1what is the longest proteoform of DPM1 homo sapiens huma.pdf
1what is the longest proteoform of DPM1  homo sapiens huma.pdf1what is the longest proteoform of DPM1  homo sapiens huma.pdf
1what is the longest proteoform of DPM1 homo sapiens huma.pdf
 
Troubled Asset Relief Program TARP is a group of programs .pdf
Troubled Asset Relief Program TARP is a group of programs .pdfTroubled Asset Relief Program TARP is a group of programs .pdf
Troubled Asset Relief Program TARP is a group of programs .pdf
 
Cul de las siguientes tecnologas de energa alternativa r.pdf
Cul de las siguientes tecnologas de energa alternativa r.pdfCul de las siguientes tecnologas de energa alternativa r.pdf
Cul de las siguientes tecnologas de energa alternativa r.pdf
 
Como medio de pago las monedas tienen el gran inconveniente.pdf
Como medio de pago las monedas tienen el gran inconveniente.pdfComo medio de pago las monedas tienen el gran inconveniente.pdf
Como medio de pago las monedas tienen el gran inconveniente.pdf
 
4 Qualitatively describe the processes through which deep .pdf
4 Qualitatively describe the processes through which deep .pdf4 Qualitatively describe the processes through which deep .pdf
4 Qualitatively describe the processes through which deep .pdf
 
Rank the following from highest average historical return to.pdf
Rank the following from highest average historical return to.pdfRank the following from highest average historical return to.pdf
Rank the following from highest average historical return to.pdf
 
Wanda se queja con Jackie de que el uso de guiones la hace s.pdf
Wanda se queja con Jackie de que el uso de guiones la hace s.pdfWanda se queja con Jackie de que el uso de guiones la hace s.pdf
Wanda se queja con Jackie de que el uso de guiones la hace s.pdf
 
Why has natural selection favored the evolution of double ci.pdf
Why has natural selection favored the evolution of double ci.pdfWhy has natural selection favored the evolution of double ci.pdf
Why has natural selection favored the evolution of double ci.pdf
 
Which of the following is usually NOT true about turnkey inf.pdf
Which of the following is usually NOT true about turnkey inf.pdfWhich of the following is usually NOT true about turnkey inf.pdf
Which of the following is usually NOT true about turnkey inf.pdf
 

Recently uploaded

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 

Recently uploaded (20)

Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 

Below is a Password Management Program incl.pdf

  • 1. Below is a Password Management Program #include <stdio.h> #include <string.h> #define MAX_USERS 100 struct user { char username[20]; char password[20]; char codeword[20]; }; int num_users = 0; struct user users[MAX_USERS]; int find_user_index(char *username) { for (int i = 0; i < num_users; i++) { if (strcmp(users[i].username, username) == 0) { return i; } } return -1; } void add_user() { if (num_users == MAX_USERS) { printf("Error: maximum number of users reachedn"); return; } struct user u; printf("Enter username: "); scanf("%s", u.username); printf("Enter password: "); scanf("%s", u.password); printf("Enter codeword: "); scanf("%s", u.codeword); users[num_users++] = u; } void edit_user() { char username[20]; printf("Enter username to edit: "); scanf("%s", username); int i = find_user_index(username); if (i == -1) { printf("Error: user not foundn"); return; }
  • 2. struct user u = users[i]; printf("Enter new password (or press enter to keep current password): "); scanf("%s", u.password); printf("Enter new codeword (or press enter to keep current codeword): "); scanf("%s", u.codeword); users[i] = u; } void display_users() { printf("%-20s %-20s %-20sn", "Username", "Password", "Codeword"); for (int i = 0; i < num_users; i++) { printf("%-20s %-20s %-20sn", users[i].username, users[i].password, users[i].codeword); } } void remove_user() { char username[20]; printf("Enter username to remove: "); scanf("%s", username); int i = find_user_index(username); if (i == -1) { printf("Error: user not foundn"); return; } for (int j = i; j < num_users - 1; j++) { users[j] = users[j + 1]; } num_users--; } int main() { int choice; while (1) { printf("n"); printf("1. Add usern"); printf("2. Edit usern"); printf("3. Display usersn"); printf("4. Remove usern"); printf("5. Exitn"); printf("Enter choice: "); scanf("%d", &choice); switch (choice) { case 1: add_user(); break;
  • 3. case 2: edit_user(); break; case 3: display_users(); break; case 4: remove_user(); break; case 5: return 0; default: printf("Error: invalid choicen"); } } } Test and Debug the above program