-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.cpp
More file actions
38 lines (30 loc) · 747 Bytes
/
Copy patharray.cpp
File metadata and controls
38 lines (30 loc) · 747 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
#include <iostream>
#include <string>
using namespace std;
int main() {
int nums[5] = {1,2,3,4,5};
cout << "Array elements:\n";
int j = 0;
for(int i = 0; i <= 4; i++){
j = nums[i] + j;
}
cout << "\n";
cout << j << "\n";
string names[3] = {"Ali", "Reza", "Sara"};
for (int i = 0; i < 3; i++){
cout << names[i] << " \n";
}
string list[3];
cin.ignore();
for(int i = 0; i < 3; i++){
cout << "Enter Name " << i + 1 << ": ";
getline(cin, list[i]);
}
for (int i = 0; i < 3; i++) {
cout << list[i] << "\n";
}
string text = "Hello C++";
cout << "Text: " << text << "\n";
cout << "Length: " << text.length() << "\n";
return 0;
}