-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharea51.cpp
More file actions
59 lines (41 loc) · 906 Bytes
/
area51.cpp
File metadata and controls
59 lines (41 loc) · 906 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
53
54
55
56
57
58
59
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>;
using namespace std;
int main(int argc, char** argv)
{
if (argc<3)
{
cout << "usage: area51 <length> <width>\n";
exit(0);
}
float length = atof(argv[1]);
float width = atof(argv[2]);
cout << "area: " << length * width << endl;
/*
cout << "num args:" << argc;
cout << "arguments:" << endl;
for(int i=0; i<argc; i++)
{
cout << argv[i] << endl;
}
cout << "area51" << endl;
cout << "input length: ";
float length;
cin >> length;
cout << "input width: ";
float width;
cin >> width;
cout << "length=" << length << endl;
cout << "width=" << width << endl;
cout << "area=" << length*width << endl;
string sentence;
cout << "input a sentence: ";
getline(cin, sentence);
cout << sentence.size() << endl;
istringstream ss(sentence);
string w;
while (ss >> w) cout << w << endl;
*/
}