Created
May 9, 2022 01:54
-
-
Save hakxcore/5235c4eb71aeb335d09d54d024f35fec to your computer and use it in GitHub Desktop.
This file contains hidden or 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
## Input.cpp //for input to the numberAdder | |
/* Program to add two numbers using cpp | |
Take three variables a, b, c | |
Input a, b from user | |
add a and b to c | |
print c | |
*/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
int main() | |
{ | |
// Three variables a b c | |
int a, b, c; | |
cin >> a >> b; // Input a b from user | |
c = a + b; // add a b to c | |
cout << c; // Print output | |
return 0; | |
} | |
## NumberAdder Code | |
#include <bits/stdc++.h> | |
using namespace std; | |
int main() | |
{ | |
ifstream InputFile("input.cpp"); | |
ofstream OutputFile("output_NmbrsAdded.cpp"); | |
string line; | |
int i = 1; | |
while (getline(InputFile, line)) | |
{ | |
OutputFile << i << ". " << line << "\n"; | |
i++; | |
} | |
return 0; | |
} | |
## Output | |
1. /* Program to add two numbers using cpp | |
2. Take three variables a, b, c | |
3. Input a, b from user | |
4. add a and b to c | |
5. print c | |
6. */ | |
7. | |
8. #include <bits/stdc++.h> | |
9. using namespace std; | |
10. | |
11. int main() | |
12. { | |
13. // Three variables a b c | |
14. int a, b, c; | |
15. cin >> a >> b; // Input a b from user | |
16. c = a + b; // add a b to c | |
17. cout << c; // Print output | |
18. return 0; | |
19. } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment