Lab12, the purpose of this lab is to improve your skills in handling c strings * with pointers. * use of : strlen , string concatenation strcat, compare strcmp, copy strcpy and search strrchr #include #include #include using namespace std; * Create a method that prompts the user for only lowercase letters to represent * a name. * Start a Label, then prompt the user to enter a name * Make a static char array to represent the name with size 30 * use scanf to scan for the name, specifier for char is %s * Declare a flag with a premise that the name is not all lowercase * Loop the length of the name, use strlen(name) for the length of name * The loop checks if the name is all lowercase letters * If the user provides invalid characters other than lowercase, goto label * @return pointer of Char char * setName() { * Similar to the previous method , * It restricts providing characters other than digits * @return char * setBadge() { Similar to the previous method, * It restricts providing characters other than uppercase * @return char * setComp() { int main(int argc, char** argv) { // Declare a name pointer and set it using setName char*name setName(); // Declare a badge pointer and set it using the method // Declare a company pointer and set it using the method // Declare a character array of size 30 char email[30]; // COPY name TO email 1/Concatenate email with '.' I/Concatenate badge with email I/Concatenate @ with email //Concatenate company name with email // Add a domain by concatenating .edu with email // Search for the last occurrence of . //The method returns a pointer pointing to the beginning of .edu // Change the values next of the pointer to make '.edu' all uppercase // Subtract -32 from the letters and that will make it uppercase // answer will be .EDU // Use strcmp to compare the previous pointer to ".EDU" // Print the email using printf, the specifier is %s // an outcome will look like : sadiq.1234@OKSTATE.EDU return 0
Stars
2
Forks
0
Watchers
2
Open Issues
0
Overall repository health assessment
No package.json found
This might not be a Node.js project
2
commits