-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
43 lines (33 loc) · 1.33 KB
/
main.cpp
File metadata and controls
43 lines (33 loc) · 1.33 KB
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
/*******************************************************************************
* Author : Jesus Lopez *
* Assignment : Chapter 10.1 *
* Class : CSC-17A 47466 *
* Date : 10/10/17 *
* Purpose : Determines c-string Length *
******************************************************************************/
#include <iostream>
#include <cstring>
using namespace std;
//Function Prototypes
int findLen(char[]);
int main(int argc, char** argv) {
//Variables
int size = 20; //Input - Size of charater string.
char userStr[size]; //Input - User character string.
int strLnth; //Output - String length.
//Asks & Retrieves Information
cout << "Enter a string:" << endl;
cin.getline(userStr, size);
//Determines String Length
strLnth = findLen(userStr);
//Outputs Information
cout << "The size of your string is " << strLnth << " characters.";
return 0;
}
//Determines String Length
int findLen(char c[])
{
int sLength; //String length.
sLength = strlen(c);
return sLength;
}