DEV Community

maxazillion
maxazillion

Posted on

SpOngEboB TExt

This is the first program that I wrote for my enjoyment. I wrote this program in c++ when I was taking an intro to c++ class in NHTI. This program is important to me because it was the first time that I realized I really enjoyed coding and saw the potential that coding offered. I saw that you could make useful code even with a basic understanding of programing. Solving problems no matter how small they are is a lot of fun for me. In this program I solved a problem that most people didn't even know was a problem. "Mocking your friends by typing back their sentence in spongebob text takes up way too much time." In this project I made it easier to randomize the capital letters in a sentence and greatly enhance the user's ability to joke with their friends. It's extremely simple It uses the randint function along with ASCII values to change lowercase letters to capital letters.

#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;

string spongebob(string sentence)
{
    int * sentence = new int[sentence.length()];
    for(int i = 0; i < sentence.length(); i++)
    {

        int j;
        j = (rand()%2)+1;

        sentence[i] = j;

    }

    for(int i = 0; i < sentence.length(); i++)
    {
        if (sentence[i] == 32)
        {
            if(sentence[i] == 1)
            {
                sentence[i] = '?';
            }
        }
        else if(sentence[i] == 1)
        {
            char temp = thang[i];
            temp = temp - 32;
            sentence[i] = temp;
        }
    }

    return thang;

}
int main(){

    srand((unsigned)time(0));

    string jason = "yeah that program is ok at best";
    cout << spongebob(jason);
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)