426nfvb77
426nfvb77
Output:
Main.cpp:6:13: warning: missing terminating " character 6 | cout << " | ^ Main.cpp:6:13: error: missing terminating " character Main.cpp:9:9: error: stray ‘\’ in program 9 | / \ / \ | ^ Main.cpp:10:10: error: stray ‘\’ in program 10 | | _ \ / _ | | ^ Main.cpp:11:9: error: stray ‘\’ in program 11 | ; | \ \ / / | ; | ^ Main.cpp:11:11: error: stray ‘\’ in program 11 | ; | \ \ / / | ; | ^ Main.cpp:12:5: error: stray ‘\’ in program 12 | \ \ \ \_.._/ / / / | ^ Main.cpp:12:8: error: stray ‘\’ in program 12 | \ \ \ \_.._/ / / / | ^ Main.cpp:12:10: error: stray ‘\’ in program 12 | \ \ \ \_.._/ / / / | ^ Main.cpp:12:12: error: stray ‘\’ in program 12 | \ \ \ \_.._/ / / / | ^ Main.cpp:13:6: warning: multi-character character constant [-Wmultichar] 13 | '. '.;' ';,' .' | ^~~~ Main.cpp:13:12: warning: multi-character character constant [-Wmultichar] 13 | '. '.;' ';,' .' | ^~~~~~ Main.cpp:13:20: warning: multi-character character constant [-Wmultichar] 13 | '. '.;' ';,' .' | ^~~~ Main.cpp:14:8: warning: unknown escape sequence: '\.' 14 | './ _ _ \.' | ^~~~~~~~~~~~~~ Main.cpp:14:8: warning: character constant too long for its type Main.cpp:15:9: warning: character constant too long for its type 15 | .' a __ a '. | ^~~~~~~~~~~~ Main.cpp:16:3: warning: unknown escape sequence: '\/' 16 | '--./ _, \/ ,_ \.--' | ^~~~~~~~~~~~~~~~~~~~~~~~ Main.cpp:16:3: warning: unknown escape sequence: '\.' Main.cpp:16:3: warning: character constant too long for its type Main.cpp:17:10: error: stray ‘\’ in program 17 | ----| \ /\ / |---- | ^ Main.cpp:17:15: error: stray ‘\’ in program 17 | ----| \ /\ / |---- | ^ Main.cpp:18:6: warning: unknown escape sequence: '\040' 18 | .--'\ '-' '-' /'--. | ^~~~~~ Main.cpp:18:6: warning: multi-character character constant [-Wmultichar] Main.cpp:18:13: warning: multi-character character constant [-Wmultichar] 18 | .--'\ '-' '-' /'--. | ^~~~ Main.cpp:18:18: warning: character constant too long for its type 18 | .--'\ '-' '-' /'--. | ^~~~~~~ Main.cpp:19:22: error: stray ‘`’ in program 19 | _>.__ -- _.- `; | ^ Main.cpp:20:6: warning: missing terminating ' character 20 | .' _ __/ _/ | ^ Main.cpp:20:6: error: missing terminating ' character 20 | .' _ __/ _/ | ^~~~~~~~~~~~~~~~~~ Main.cpp:21:9: warning: missing terminating ' character 21 | / '.,:".-\ /:, | ^ Main.cpp:21:9: error: missing terminating ' character 21 | / '.,:".-\ /:, | ^~~~~~~~~~~~~~~ Main.cpp:22:11: error: stray ‘\’ in program 22 | | \.' `""`'.\\ | ^ Main.cpp:22:13: warning: character constant too long for its type 22 | | \.' `""`'.\\ | ^~~~~~~~~ Main.cpp:22:23: error: stray ‘\’ in program 22 | | \.' `""`'.\\ | ^~ 23 | '-,.__/ _ .-. ;|_ | Main.cpp:23:5: warning: missing terminating ' character 23 | '-,.__/ _ .-. ;|_ | ^ Main.cpp:23:5: error: missing terminating ' character 23 | '-,.__/ _ .-. ;|_ | ^~~~~~~~~~~~~~~~~~~~~ Main.cpp:24:6: error: stray ‘`’ in program 24 | /` `|| _/ `\/_ \_|| `\ | ^ Main.cpp:24:8: error: stray ‘`’ in program 24 | /` `|| _/ `\/_ \_|| `\ | ^ Main.cpp:24:15: error: stray ‘`’ in program 24 | /` `|| _/ `\/_ \_|| `\ | ^ Main.cpp:24:16: error: stray ‘\’ in program 24 | /` `|| _/ `\/_ \_|| `\ | ^ Main.cpp:24:21: error: stray ‘\’ in program 24 | /` `|| _/ `\/_ \_|| `\ | ^ Main.cpp:24:26: error: stray ‘`’ in program 24 | /` `|| _/ `\/_ \_|| `\ | ^~ 25 | | ||/ \-./` \ / || | | Main.cpp:25:13: error: stray ‘\’ in program 25 | | ||/ \-./` \ / || | | ^ Main.cpp:25:17: error: stray ‘`’ in program 25 | | ||/ \-./` \ / || | | ^ Main.cpp:25:19: error: stray ‘\’ in program 25 | | ||/ \-./` \ / || | | ^ Main.cpp:26:5: error: stray ‘\’ in program 26 | \ ||__/__|___|__|| / | ^ Main.cpp:27:6: error: stray ‘\’ in program 27 | \_ |_Happy Easter_| / | ^ Main.cpp:28:6: warning: unknown escape sequence: '\040' 28 | jgs .' \ = _= _ = _= /`\ | ^~~~~~~~~~~~~~~~~~~~~ 29 | / `-;----=--;--' \ | ~~~~~~~~~~~~~~~~~~~~ Main.cpp:28:6: warning: character constant too long for its type Main.cpp:30:4: error: stray ‘\’ in program 30 | \ _.-' '. / | ^ Main.cpp:30:12: warning: character constant too long for its type 30 | \ _.-' '. / | ^~~~~~~~~~ Main.cpp:31:5: error: stray ‘`’ in program 31 | `""` `""` | ^ Main.cpp:31:8: error: stray ‘`’ in program 31 | `""` `""` | ^ Main.cpp:31:23: error: stray ‘`’ in program 31 | `""` `""` | ^ Main.cpp:31:26: error: stray ‘`’ in program 31 | `""` `""` | ^ Main.cpp: In function ‘int main()’: Main.cpp:8:9: error: expected primary-expression before ‘.’ token 8 | .-. .-. | ^ Main.cpp:8:10: error: expected unqualified-id before ‘-’ token 8 | .-. .-. | ^ Main.cpp:8:11: error: expected primary-expression before ‘.’ token 8 | .-. .-. | ^ Main.cpp:8:24: error: expected unqualified-id before ‘.’ token 8 | .-. .-. | ^ Main.cpp:8:25: error: expected unqualified-id before ‘-’ token 8 | .-. .-. | ^ Main.cpp:8:26: error: expected primary-expression before ‘.’ token 8 | .-. .-. | ^ Main.cpp:9:5: error: expected unqualified-id before ‘/’ token 9 | / \ / \ | ^ Main.cpp:9:20: error: expected primary-expression before ‘/’ token 9 | / \ / \ | ^ Main.cpp:10:4: error: expected primary-expression before ‘|’ token 10 | | _ \ / _ | | ^ Main.cpp:10:8: error: ‘_’ was not declared in this scope 10 | | _ \ / _ | | ^ Main.cpp:11:4: error: expected primary-expression before ‘;’ token 11 | ; | \ \ / / | ; | ^ Main.cpp:11:7: error: expected primary-expression before ‘|’ token 11 | ; | \ \ / / | ; | ^ Main.cpp:11:18: error: expected primary-expression before ‘/’ token 11 | ; | \ \ / / | ; | ^ Main.cpp:11:20: error: expected primary-expression before ‘/’ token 11 | ; | \ \ / / | ; | ^ Main.cpp:11:22: error: expected primary-expression before ‘|’ token 11 | ; | \ \ / / | ; | ^ Main.cpp:11:25: error: expected primary-expression before ‘;’ token 11 | ; | \ \ / / | ; | ^ Main.cpp:12:15: error: expected unqualified-id before ‘.’ token 12 | \ \ \ \_.._/ / / / | ^ Main.cpp:12:19: error: expected primary-expression before ‘/’ token 12 | \ \ \ \_.._/ / / / | ^ Main.cpp:12:21: error: expected primary-expression before ‘/’ token 12 | \ \ \ \_.._/ / / / | ^ Main.cpp:12:24: error: expected primary-expression before ‘/’ token 12 | \ \ \ \_.._/ / / / | ^ Main.cpp:13:11: error: expected unqualified-id before ‘;’ token 13 | '. '.;' ';,' .' | ^ Main.cpp:13:19: error: expected primary-expression before ‘,’ token 13 | '. '.;' ';,' .' | ^ Main.cpp:20:5: error: expected primary-expression before ‘.’ token 20 | .' _ __/ _/ | ^ Main.cpp:21:4: error: expected unqualified-id before ‘/’ token 21 | / '.,:".-\ /:, | ^ Main.cpp:22:4: error: expected primary-expression before ‘|’ token 22 | | \.' `""`'.\\ | ^ Main.cpp:22:12: error: expected primary-expression before ‘.’ token 22 | | \.' `""`'.\\ | ^ Main.cpp:22:13: error: expected unqualified-id before '\x60222260' 22 | | \.' `""`'.\\ | ^~~~~~~~~
C++ Online Compiler
Write, Run & Share C++ code online using OneCompiler's C++ online compiler for free. It's one of the robust, feature-rich online compilers for C++ language, running on the latest version 17. Getting started with the OneCompiler's C++ compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as C++
and start coding!
Read inputs from stdin
OneCompiler's C++ online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout << "Enter name:";
getline (cin, name);
cout << "Hello " << name;
return 0;
}
About C++
C++ is a widely used middle-level programming language.
- Supports different platforms like Windows, various Linux flavours, MacOS etc
- C++ supports OOPS concepts like Inheritance, Polymorphism, Encapsulation and Abstraction.
- Case-sensitive
- C++ is a compiler based language
- C++ supports structured programming language
- C++ provides alot of inbuilt functions and also supports dynamic memory allocation.
- Like C, C++ also allows you to play with memory using Pointers.
Syntax help
Loops
1. If-Else:
When ever you want to perform a set of operations based on a condition If-Else is used.
if(conditional-expression) {
//code
}
else {
//code
}
You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.
2. Switch:
Switch is an alternative to If-Else-If ladder.
switch(conditional-expression){
case value1:
// code
break; // optional
case value2:
// code
break; // optional
......
default:
code to be executed when all the above cases are not matched;
}
3. For:
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
//code
}
4. While:
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while (condition) {
// code
}
5. Do-While:
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
Functions
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity. Function gets run only when it is called.
How to declare a Function:
return_type function_name(parameters);
How to call a Function:
function_name (parameters)
How to define a Function:
return_type function_name(parameters) {
// code
}