Created
May 9, 2022 02:00
-
-
Save hakxcore/3e797a0451215a064caf76b1edc84e38 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 file (input.cpp) | |
/* 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; | |
} | |
## Space Remover Code | |
#include <bits/stdc++.h> | |
using namespace std; | |
int main() | |
{ | |
ifstream InputFile("input.cpp"); | |
ofstream OutputFile("Output_spcsRmovd.cpp"); | |
string line; | |
while (getline(InputFile, line)) | |
{ | |
for (int i = 0; i < (int)line.size(); i++) | |
{ | |
if (line.at(i) != ' ') | |
{ | |
OutputFile << line.at(i); | |
} | |
} | |
OutputFile << "\n"; | |
} | |
return 0; | |
## Output | |
/*Programtoaddtwonumbersusingcpp | |
Takethreevariablesa,b,c | |
Inputa,bfromuser | |
addaandbtoc | |
printc | |
*/ | |
#include<bits/stdc++.h> | |
usingnamespacestd; | |
intmain() | |
{ | |
//Threevariablesabc | |
inta,b,c; | |
cin>>a>>b;//Inputabfromuser | |
c=a+b;//addabtoc | |
cout<<c;//Printoutput | |
return0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment