<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: jacob777baltimore</title>
    <description>The latest articles on DEV Community by jacob777baltimore (@jacob777baltimore).</description>
    <link>https://dev.to/jacob777baltimore</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F521456%2F75b6a9ea-8847-4371-a100-ae0d8bcc1f29.png</url>
      <title>DEV Community: jacob777baltimore</title>
      <link>https://dev.to/jacob777baltimore</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jacob777baltimore"/>
    <language>en</language>
    <item>
      <title>How to make text based games in C++?</title>
      <dc:creator>jacob777baltimore</dc:creator>
      <pubDate>Thu, 26 Nov 2020 21:11:25 +0000</pubDate>
      <link>https://dev.to/jacob777baltimore/how-to-make-text-based-games-in-c-bmd</link>
      <guid>https://dev.to/jacob777baltimore/how-to-make-text-based-games-in-c-bmd</guid>
      <description>&lt;p&gt;Computers can be used for different uses, we can use computers for playing games. By hearing the word game we start thinking about great animation and graphics but there is a category of games “text-based games” in which we only use text. Text-based games are fun. In this article we are going to discuss them and how to create them. I am assuming that you have some knowledge of programming. We will be using C++ for programming in this article.&lt;/p&gt;

&lt;h1&gt;
  
  
  Ideas
&lt;/h1&gt;

&lt;p&gt;Before creating the game we need ideas for the game. Idea is the first step towards the creation of the game. The game should be enjoyable and somehow unique. You can create your own story for the game just imagine and write down your story.&lt;/p&gt;

&lt;p&gt;You can tell your story in two ways. First is unfolding at once and the second is unfolding it while you create.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;All at once.&lt;/strong&gt; Write your story then reveal it in a linear or parallel way in your game.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;While you create.&lt;/strong&gt; In this method you let your imagination flow as fire while you write your story bit by bit.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choosing the method for telling the story is completely your call. In text-based games we have to make the player interact with the game. Start with the simple question or a simple sentence. Remember not to throw random sentences since it will make the player uncomfortable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1 Taking Text Input
&lt;/h2&gt;

&lt;p&gt;In this step we have to take the input from the player. We have to interact and take input from the user so many times in this game. So it is important to learn how to do that. For example in a game, you are asking the player for his/her name and then you will be returning the name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;conio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
using namespace std;

int main()
{
    char name[50];
    cout &amp;lt;&amp;lt; "What is your name, warrior?" &amp;lt;&amp;lt; endl;
    cin.getline(name, 50);
    cout &amp;lt;&amp;lt; "You better move fast, " &amp;lt;&amp;lt; name &amp;lt;&amp;lt; ". The goblins are attacking the city." &amp;lt;&amp;lt; endl;
    cout &amp;lt;&amp;lt; "\n----------------------Press any key to continue----------------------" &amp;lt;&amp;lt; endl;
    _getch();
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.kodlogs.com/blog/466/how-to-make-text-based-games-in-c"&gt;Read more&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>opensource</category>
      <category>oop</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Python remove all whitespace</title>
      <dc:creator>jacob777baltimore</dc:creator>
      <pubDate>Thu, 26 Nov 2020 20:06:40 +0000</pubDate>
      <link>https://dev.to/jacob777baltimore/python-remove-all-whitespace-4m3n</link>
      <guid>https://dev.to/jacob777baltimore/python-remove-all-whitespace-4m3n</guid>
      <description>&lt;p&gt;Python String is immutable in nature. What does it mean? In C, C++, or Java, we can change the value of a string after initialization. It means String is mutable in these programming languages. In the case of Python, once we initialize a string it becomes final and we do not have the authority to change the string value. In Python, any function that manipulates string value returns a new string and we have to explicitly assign it to the string, unless, the string value won’t change. Let’s discuss how we can manipulate and remove the white spaces from a string in Python. There are two methods 1. strip() method 2. replace() method&lt;/p&gt;

&lt;h1&gt;
  
  
  Using the strip() method:
&lt;/h1&gt;

&lt;p&gt;Python string has a built-in function named .strip(). This function removes all the whitespace (leading and trailing) from the string explicitly. We can perform the same thing applying by the lstrip() or rstrip() function instead.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;is_a_string = "  My name is John    "
print(is_a_string.strip())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sample string has whitespace in both starting and at the end of it. Applying the strip() function will remove those whitespaces and return the string as:&lt;br&gt;
&lt;code&gt;My name is John&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.kodlogs.com/blog/1088/python-remove-all-whitespace"&gt;Read Replace method&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>oop</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>java check if the string is empty.</title>
      <dc:creator>jacob777baltimore</dc:creator>
      <pubDate>Thu, 26 Nov 2020 20:00:25 +0000</pubDate>
      <link>https://dev.to/jacob777baltimore/java-check-if-the-string-is-empty-11d</link>
      <guid>https://dev.to/jacob777baltimore/java-check-if-the-string-is-empty-11d</guid>
      <description>&lt;h1&gt;
  
  
  Java program to check if a string is empty or null:
&lt;/h1&gt;

&lt;p&gt;In the above program, we check that the isEmpty() method will only check whether the String is empty or not. If the user wants to check whether the given String is null or empty then you can do this in following ways;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Example{

   public static void main(String args[]){ 

               String str1 = null;

               String str2 = "beginners book"; 

               if(str1 == null || str1.isEmpty()){

                  System.out.println("String str1 is empty or null");

               }

               else{

                  System.out.println(str1);

               }

               if(str2 == null || str2.isEmpty()){

                  System.out.println("String str2 is empty or null"); 

               }

               else{

                  System.out.println(str2);

               }

   }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.kodlogs.com/blog/1080/java-check-if-the-string-is-empty"&gt;Read more&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Output
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String str1 is empty or null

beginners book
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>java</category>
      <category>oop</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Java call a method from another class.</title>
      <dc:creator>jacob777baltimore</dc:creator>
      <pubDate>Thu, 26 Nov 2020 19:52:19 +0000</pubDate>
      <link>https://dev.to/jacob777baltimore/java-call-a-method-from-another-class-4gp8</link>
      <guid>https://dev.to/jacob777baltimore/java-call-a-method-from-another-class-4gp8</guid>
      <description>&lt;p&gt;Java can call a method from another class by using the behavior and the access level is present there. Following access modifiers can be used within the methods.&lt;/p&gt;

&lt;h1&gt;
  
  
  Access level / Modifiers:
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Public:
&lt;/h2&gt;

&lt;p&gt;In public modifiers, methods are visible to any other class you are using. The users can access from anywhere as long as they create a new instance of the class otherwise the user will get NullPointerException.&lt;/p&gt;

&lt;h2&gt;
  
  
  Private:
&lt;/h2&gt;

&lt;p&gt;In private modifier, methods are only visible within that class. Methods are only available within the method that is encapsulated in that class.&lt;/p&gt;

&lt;h2&gt;
  
  
  Protected:
&lt;/h2&gt;

&lt;p&gt;In protected access modifier is limited to package. The users can get the ability for their subclass outside the superclass package by using the to inherit methods and constructors. The users can only access by using the inheritance. In this way methods only extend the superclass functionalities not replace it. &lt;a href="https://www.kodlogs.com/blog/877/java-call-a-method-from-another-class"&gt;Read more&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>computerscience</category>
      <category>oop</category>
    </item>
    <item>
      <title>In programming, the terms "line" and "statement" always mean the same thing.</title>
      <dc:creator>jacob777baltimore</dc:creator>
      <pubDate>Thu, 26 Nov 2020 19:50:27 +0000</pubDate>
      <link>https://dev.to/jacob777baltimore/in-programming-the-terms-line-and-statement-always-mean-the-same-thing-3l6l</link>
      <guid>https://dev.to/jacob777baltimore/in-programming-the-terms-line-and-statement-always-mean-the-same-thing-3l6l</guid>
      <description>&lt;p&gt;No, the Statement is a group of lines. &lt;br&gt;
One statement contains many lines &lt;/p&gt;

&lt;h1&gt;
  
  
  For example:
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int main()
{
    int x, y;
    printf("enter the value of x:");
    scanf("%d", &amp;amp;x);
    printf("enter the value of y:");
    scanf("%d", &amp;amp;y);
    if (x&amp;gt;y)
    {
           printf("x is greater than y\n");
    }
    if (x&amp;lt;y)
    {
           printf("x is less than y\n");
    }
    if (x==y)
    {
           printf("x is equal to y\n");
    }
    printf("End of Program");
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The above example contains 22 lines but 3 number of Statements are three.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Line
&lt;/h2&gt;

&lt;p&gt;Lines of code are the "source code" of the program, and one line may produce one machine guidance or a few relying upon the programming language. ... In an elevated level language, for example, C++ or Java, one line of code produces a progression of low-level computing construct guidelines, which brings about different machine directions. &lt;/p&gt;

&lt;h2&gt;
  
  
  Statements
&lt;/h2&gt;

&lt;p&gt;In PC programming, a Statement is a syntactic unit of a basic programming language that communicates some activity to be done. A grouping of at least one explanation shapes a program written in such a language. An announcement may have inward part &lt;/p&gt;

&lt;h2&gt;
  
  
  Type of statements
&lt;/h2&gt;

&lt;p&gt;Assignment statements are used to assign a program variable. Flow control explanations help direct the request where statements are performed.&lt;/p&gt;

&lt;h3&gt;
  
  
  There are four types of control statements
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.kodlogs.com/blog/849/programming-the-terms-line-statement-always-mean-same-thing"&gt;Read more&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
