In B4Coder you build a program from flowchart blocks, run it step by step, then press View Code to see it as C++. Change the flowchart and the C++ changes with it.
C++ is used in engineering colleges, competitive programming and anywhere speed matters. It reads like Java with cin and cout for input and output, and B4Coder works out each value's type for you.
About the code B4Coder writes: C++17. Each value's type (int, double, string) is worked out from your blocks. A list or object put in another value is copied, not shared.
The most common blocks, and the C++ they turn into. View Code uses your own names and values.
getline(cin, line); age = stoi(line);
cout << "Hello, " << name << endl;
int total = 0;
if (age >= 18) {
...
} else {
...
}for (int i = 0; i < 10; i++) {
...
}while (total < 100) {
...
}Each one is a flowchart in B4Coder. This is the C++ it turns into, exactly as View Code writes it.
Ask for two numbers and show the sum.
#include <iostream>#include <string>#include <iomanip>
using namespace std;
int main() { cout << setprecision(15); double a = 0; double b = 0; double sum = 0; string line;
cout << "What is the first number? "; getline(cin, line); a = stod(line); cout << "What is the second number? "; getline(cin, line); b = stod(line); sum = a + b; cout << "The sum is " << sum << endl;}Check whether a number is even or odd.
#include <iostream>#include <string>
using namespace std;
int main() { int number = 0; string line;
cout << "Enter a number "; getline(cin, line); number = stoi(line); if (number % 2 == 0) { cout << "It is an Even number" << endl; } else { cout << "It is an Odd number" << endl; }}Use a repeat loop to count from 1 to 10.
#include <iostream>#include <string>
using namespace std;
int main() { int count = 0;
count = 1; for (int i0 = 0, n0 = 10; i0 < n0; i0++) { cout << "Count: " << count << endl; count = count + 1; }}Build a flowchart, press Run to watch it work, then open View Code and pick C++. It's free, with no install.
Open the editor