3 Ways To Say I Love You (In Code)

Example 1:

#include <iostream>
#include <cstdlib>

using namespace std;

int main() {
  int two;
  two = 1;
  while(two == 1) {
    cout << "I love you little red haired girl\n";
  }
}

Example 2:

#include <iostream>
#include <cstdlib>

using namespace std;

void myLoveGrowsDeeper(int lvl);

int main() {
  int lvl = 1;
  cout << "My love grows deeper";
  myLoveGrowsDeeper(lvl);
  cout << " every day." << endl;
}

void myLoveGrowsDeeper(int lvl) {
  if(lvl == 99) {
    return;
  }
  myLoveGrowsDeeper(lvl+1);
  cout << " and deeper ";
}

Example 3 (Turtle Commands, Pixels, Degrees):

LEFT 45
FORWARD 100
REPEAT 180
  FORWARD PI/2
  LEFT 1
RIGHT 90
REPEAT 180
  FORWARD PI/2
  LEFT 1
FORWARD 100





3 Comments

Filed under Trube On Tech

3 responses to “3 Ways To Say I Love You (In Code)

  1. Nice touch with the turtle commands!

  2. aren’t you just the sweetest!

  3. can someone fix this
    import turtle as t
    t.left(45)
    t.forward(100)
    t.repeat(180)
    t.forward(3.14/2)#FORWARD PI/2
    t.left(1)
    t.right(90)
    t.repeat(180
    t.forward(3.14/2)# FORWARD PI/2
    t.left(1)
    t.forward(100)#FORWARD 100
    #python
    # wastefifty.com

Leave a comment