PPAP in C++ and Javascript for Beginner


Recently, the PPAP song becomes hot in internet. Here is the original version and the cover:

C++ version of PPAP

Really, this C++ code is just for beginner. The Ugh function combines two things.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <string>
 
using namespace std;
 
// Ugh connects two things together
string Ugh(string a, string b) {
    return a + ' ' + b;
}
 
int main() {
    const string pen = "Pen";
    const string apple = "Apple";
    const string pineapple = "Pineapple";
    const string ppap = Ugh(Ugh(pen, pineapple), Ugh(apple, pen));
    cout << ppap << endl;
    return 0;
}
#include <iostream>
#include <string>

using namespace std;

// Ugh connects two things together
string Ugh(string a, string b) {
    return a + ' ' + b;
}

int main() {
    const string pen = "Pen";
    const string apple = "Apple";
    const string pineapple = "Pineapple";
    const string ppap = Ugh(Ugh(pen, pineapple), Ugh(apple, pen));
    cout << ppap << endl;
    return 0;
}

This should give you a nice PPAP:

ppap-cpp-output-console PPAP in C++ and Javascript for Beginner beginner c / c++ funny

ppap-cpp-output-console

Javascript PPAP

Quite similar, hit F12 in Chrome and goto Console. Paste the following code.

1
2
3
4
5
6
7
8
9
10
var pen = 'Pen';
var apple = 'Apple';
var pineapple = 'Pineapple';
 
var Ugh = function(a, b) {
   return a + ' ' + b;
}
 
var ppap = Ugh(Ugh(pen, pineapple), Ugh(apple, pen));
console.log(ppap);
var pen = 'Pen';
var apple = 'Apple';
var pineapple = 'Pineapple';

var Ugh = function(a, b) {
   return a + ' ' + b;
}

var ppap = Ugh(Ugh(pen, pineapple), Ugh(apple, pen));
console.log(ppap);

This should output to console with a nice PPAP string in full:

Pen Pineapple Apple Pen Click To Tweet

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
289 words
Last Post: How to Get Notified when Vultr Balance is Falling Below Threshold?
Next Post: The One-Line C# Linq Implementation of LineSpace Algorithm

The Permanent URL is: PPAP in C++ and Javascript for Beginner

2 Comments

  1. Stuardo

Leave a Reply