Advertisement
Guest User

string

a guest
Jul 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. String original="qwertyuiopasdfghjklzxcvbnm"; //the two strings to be printed I.
  2. String encrypted;
  3. void setup(){
  4. size(1200,600);
  5. textSize(40);
  6. fill(0);
  7. // text("a",50,50);
  8. text(int('a'),50,85);
  9. // text(char(int('a')+1),50,115);
  10. myprint(original,60);//printing first string, "original" being used as value of variable 's' IV.
  11. encrypted=encrypt(original); // equates second string to be printed with the new string made out of first one V.
  12. myprint(encrypted,334); //printing second string at different vertical placement VI.
  13. }
  14. void draw(){
  15. }
  16. String encrypt(String s){ //defines new string as an altering the one below by copying variable 's' but does not print III.
  17. String s2="";
  18. for(int i=0;i<s.length()-1; i=i+1){
  19. s2=s2+char(int(s.charAt(i)+int(s.charAt(i+1)))/2);}
  20. return s2;
  21. }
  22.  
  23. void myprint(String s,int y){ //function that prints a string with given vertical placement
  24. for(int i=0;i<s.length();i=i+1){ //s is a variable defined here II.
  25. textSize(50);
  26. text(s.charAt(i),i*50,y+i);}
  27. }
  28. void keyPressed(){
  29. // if(key == ' '){=true;}
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement