-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathex31.cpp
More file actions
52 lines (37 loc) · 915 Bytes
/
Copy pathex31.cpp
File metadata and controls
52 lines (37 loc) · 915 Bytes
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
/*
CPSC 121-0X
Paul De Palma
depalma
Example 31
*/
//array names are addresses, some c-string and character functions
#include <iostream>
#include <cstring>
using namespace std;
void shift(char[]);
int main()
{
char stuff[6];
char stuffConv[6];
cout << "Enter 5 lower case characters" << endl;
cin.getline(stuff,6,'\n'); //Read until 6 chars have been entered
//including '\n' or until '\n', whichever
//is first
cout << stuff << endl;
shift(stuff);
cout << "Returned from shift" << endl;
cout << stuff << endl;
strcpy(stuffConv,stuff);
cout << "Display the copy" << endl;
cout << stuffConv << endl;
return 0;
}
/*
Pre: line is a C-string filled with lower case characters
Post: All characters in line are upper case
*/
void shift(char line[])
{
for (int i = 0; i < strlen(line); i++)
line[i] = toupper(line[i]);
}