EXP 5 Merged AP LAB (Nemesis)
EXP 5 Merged AP LAB (Nemesis)
Experiment 5(A)
Student Name: ZORO UID: 22BAI
Branch: CSE Section/Group:
Semester: 5 Date of Performance:
Subject Name: Advanced Programming Lab-1 Subject Code: 22CSP-314
1. Title: Pangrams
2. Aim: Pangram is a string that contains every letter of the alphabet. Given a sentence
determine whether it is a pangram in the English alphabet. Ignore case. Return either
pangram or not program as appropriate
3. Objective:
Complete the function pangrams in the editor below. It should return the string
pangram if the input string is a pangram. Otherwise, it should return not
pangram.pangrams has the following parameter(s):
string s: a string to test
It returns either pangram or not pangram
4. Algorithm:
Update the array at the index corresponding to the lowercase letter of each character.
Return "pangram"
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
5. Implementation/Code
#include <bits/stdc++.h>
using namespace std;
string pangrams(string s) {
bool letters[26] = {false};
for (char c : s) {
if (isalpha(c)) {
letters[tolower(c) - 'a'] =
true;
}
}
for (bool present : letters) {
if (!present) {
return "not pangram";
}
}
return "pangram";
}
int main() {
string s;
getline(cin, s);
cout << pangrams(s) <<
endl;
return 0;
}
6. Output:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
7. Learning Outcomes:
Experiment 5(B)
Student Name: ZORO UID: 22BAI
Branch: CSE Section/Group:
Semester: 5 Date of Performance:
Subject Name: Advanced Programming Lab-1 Subject Code: 22CSP-314
1. Title: Pangrams
4. Algorithm:
Experiment 5(C)
Student Name: ZORO UID: 22BAI
Branch: CSE Section/Group:
Semester: 5 Date of Performance:
Subject Name: Advanced Programming Lab-1 Subject Code: 22CSP-314
2. Aim:
Louise joined a social networking site to stay in touch with her friends. The signup
page required her to input a name and a password. However, the password must be
strong. The website considers a password be strong if it satisfies the following criteria:
Its length is at least 6.
It contains at least one digit.
It contains at least one lowercase English character.
It contains at least one uppercase English character.
It contains at least one special character. The special characters are: !@#$%^&*()-+
3. Objective:
Initialize flags for uppercase letters, lowercase letters, digits, and special characters.
Iterate through each character in the password and set the appropriate flags.
Return the maximum of the needed characters or the difference to reach length 6.
5. Implementation/Code
#include <bits/stdc++.h>
using namespace std;
int minimumNumber(int n,
const string& password) {
bool hasUpper = false;
bool hasLower = false;
bool hasDigit = false;
bool hasSpecial = false;
Output:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
6. Learning Outcomes:
Learn how to check for the presence of different char types in a password.
Understand how to determine the number of characters needed to meet
password strength criteria.
Implement logic for handling edge cases related to password length and
character requirements.