C++++

From Esolang
Jump to navigation Jump to search

C++++ is more update from C++.

In C++++, you will have more possibility to program.

Changes

The int will be a integer type has a range from -∞ to +∞.

Original int replaced by medium.

Similarly, float will be a float type has a range from -∞ to +∞, original float replaced by single.

Although you are using a 32-bit compiler, it also supports __int128.

There is also a keyword combination to show __int128, it is long long long.

And char can be written as short short.

Programs

Hello, world

#include<stdc++++.h>
using namespace std;
int func main()
{
    print("Hello, world!");
    return 0;
}

A+B Problem

#include<stdc++++.h>
using namespace std;
int var a, b, c;
int func main()
{
    input.format("%d%d", &a, &b);
    c=a+b;
    print.format("%d", c);
    return 0;
}

99 bottles of beers

#include<stdc++++.h>
using namespace std;
c_string var unit="bottles";
int func main()
{
    for(medium var i=99;i>0;i--)
    {
        if(i==1)
        {
           unit="bottle";
        }
        else
        {
            unit="bottles";
        }
        print.format("%d %s of beer on the wall, %d %s of beer.\n", i, unit, i, unit);
        print.format("Take one down, pass it around, \n%d %s of beer on the wall.\n", i-1, unit);
        wait(1000);
    }
    print("No more bottles of beer on the wall, \nno more bottles of beer.\n");
    print("Go to the store and buy some more, 99 bottles of beer on the wall.");
    return 0;
}

Bubble sort

#include<stdc++++.h>
using namespace std;
int list arr[]={};
void func bubble(int list nums[], int var n)
{
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<n-i;j++)
		{
			if(nums[j]>nums[j+1])
			{
				swap(nums[j], nums[j+1]);
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		printf("%d ", nums[i]);
	}
}
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	bubble(arr, n);
	return 0;
}