-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Week_1_Orientation_Write_a_cpp_program
- Loading branch information
1 parent
db1b16f
commit e88837a
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...iented Data Structures in Cpp/Week_1_Orientation_Write_a_cpp_program/Week_1_Challenge.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
|
||
|
||
// You should define Pair here: | ||
// (Use as many lines as you need!) | ||
// ... | ||
// ... | ||
class Pair{ | ||
public: | ||
int a; | ||
int b; | ||
|
||
int sum() | ||
{ | ||
return (a+b); | ||
} | ||
|
||
}; | ||
//End of definition of class Pair | ||
|
||
|
||
|
||
// This main() function will help you test your work. | ||
// Click Run to see what happens. | ||
// When you're sure you're finished, click Submit for grading | ||
// with our additional hidden tests. | ||
int main() { | ||
Pair p; | ||
p.a = 100; | ||
p.b = 200; | ||
|
||
// expected output | ||
// Success! | ||
if (p.a + p.b == p.sum()) { | ||
|
||
std::cout << "Success!" << std::endl; | ||
|
||
} else { | ||
|
||
std::cout << "p.sum() returns " << p.sum() << " instead of " << (p.a + p.b) << std::endl; | ||
} | ||
return 0; | ||
} |
Binary file added
BIN
+56.4 KB
...iented Data Structures in Cpp/Week_1_Orientation_Write_a_cpp_program/Week_1_Challenge.exe
Binary file not shown.
Binary file added
BIN
+310 KB
...p/Week_1_Orientation_Write_a_cpp_program/Week_1_Orientation Quiz_and_Reference Manual.pdf
Binary file not shown.
Binary file added
BIN
+1.05 MB
...ctures in Cpp/Week_1_Orientation_Write_a_cpp_program/Week_1_Quiz_and_Reference Manual.pdf
Binary file not shown.