Given a source code in C++. Print the source code after cleaning it as follows : 1. If there are comments you have to remove them all whether it's a single comment (e.g. : //) or a block comment (e.g.: /**/). 2. If there are any blank lines or lines consists of spaces you must remove them all.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 9E: (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question
|%Y0 l. lin. e
Z. Clean Code
time limit per test: 1 seconde
memory limit per test: 256 megabytes
input: standard input
output: standard output
Given a source code in C++. Print the source code after cleaning it as follows :
1. If there are comments you have to remove them all whether it's a single
comment (e.g. : //) or a block comment (e.g.: /**/).
2. If there are any blank lines or lines consists of spaces you must remove them
all.
See the test cases carefully for more clarifications.
Input
Source code in C++ (maximum number of lines is 50).
Output
Print the clean code according to the problem statement.
Example
input
Соpy
// I am a single comment and you must remove me : ((
I am a block comment and you must remove me
* /
#include<iostream>
using namespace std;
int main () {
int a, b;
cin
a » b; // Reading two variables from user (please remove
>>
me !! :
cout «
а + b « endl:
// End of the program (remove me please :) )
return 0 ;
output
Соpy
#include<iostream>
using namespace std;
int main () {
int a, b ;
cin » a » b;
cout
« а + b « endl;
return 0;
}
Note
Please be careful in handling the priority of comments.
Comment symbols may be included in comments and it's not guaranteed that the
resulting source code is a valid C++ syntax.
Codeforces (c) Copvriaht 2010-2021 Mike Mirzavanov
II
>
Transcribed Image Text:|%Y0 l. lin. e Z. Clean Code time limit per test: 1 seconde memory limit per test: 256 megabytes input: standard input output: standard output Given a source code in C++. Print the source code after cleaning it as follows : 1. If there are comments you have to remove them all whether it's a single comment (e.g. : //) or a block comment (e.g.: /**/). 2. If there are any blank lines or lines consists of spaces you must remove them all. See the test cases carefully for more clarifications. Input Source code in C++ (maximum number of lines is 50). Output Print the clean code according to the problem statement. Example input Соpy // I am a single comment and you must remove me : (( I am a block comment and you must remove me * / #include<iostream> using namespace std; int main () { int a, b; cin a » b; // Reading two variables from user (please remove >> me !! : cout « а + b « endl: // End of the program (remove me please :) ) return 0 ; output Соpy #include<iostream> using namespace std; int main () { int a, b ; cin » a » b; cout « а + b « endl; return 0; } Note Please be careful in handling the priority of comments. Comment symbols may be included in comments and it's not guaranteed that the resulting source code is a valid C++ syntax. Codeforces (c) Copvriaht 2010-2021 Mike Mirzavanov II >
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,