blob: 442b0013a503ce64bbf41f04a84b98d8ec476851 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// created by till-t
// 2-nov-2021
// cst 116
#include "source.h"
// get input for name
void getName() {
char first[100]{0};
char last[100]{0};
cout << "Please enter your first name: ";
cin >> first;
cout << "Please enter your last name: ";
cin >> last;
cout << first << ", " << last;
}
/*
char first[100];
char last[100];
char fullName[100];
// void getFirst(char&)
printf("Enter your first name: ");
scanf("%s", first);
while(getchar() != '\n'); // remove new line char
printf("Enter your last name: ");
scanf("%s", last);
while(getchar() != '\n'); // remove new line char
first[0] = toupper(first[0]);
last[0] = toupper(last[0]);
// Now, concat first and last
int i = 0;
int j = 0;
while(last[j] != '\0') {
fullName[i++] = last[j++];
}
fullName[i++] = ',';
fullName[i++] = ' ';
j = 0;
while(first[j] != '\0') {
fullName[i++] = first[j++];
}
fullName[i] = '\0';
printf("First name: %s\n", first);
printf("Last name: %s\n", last);
printf("Full name: %s\n", fullName);
*/
|