Thursday, August 3, 2017

Making a Diamond Aski Art in C

This is the expected final output. User will enter a number n where n is the position of the middle column asterisk. This exercise requires multiple nested loops


Diamond.C
#include
int main()
{
  int n, inner, outer, space = 1;

  printf("Enter a number\n");
  scanf("%d", &n);

  space = n - 1;

  for (outer = 1; outer <= n; outer++)
  {
    for (inner = 1; inner <= space; inner++)
      printf(" ");

    space--;

    for (inner = 1; inner <= 2*outer-1; inner++)
      printf("*");

    printf("\n");
  }

  space = 1;
  for (outer = 1; outer <= n- 1; outer++)
  {
    for (inner = 1; inner <= space; inner++)
      printf(" ");

    space++;

    for (inner = 1 ; inner <= 2*(n-outer)-1; inner++)
      printf("*");

    printf("\n");
  }

  return 0;
}
The Code diamond's number of rows is n/2-1to make n's value to be the middle row.


Saturday, June 24, 2017

Getting GCC on Windows 10 with Ubuntu Subsystem

The following requires Windows 10 2016 Anniversary update (build 1607). I like that I can use Vim on Windows 10 and compile easily. The slide below shows the steps on how to do it.


Saturday, February 25, 2017

Awaiting Visual Studio 2017

I have been using Visual Studio for the past couple of years. Even though I have frustrations with it, it is still my preferred IDE. I tried others such as Eclipse and Netbeans and they have grown through the years as well. I grew fond of Visual Studio after I got more comfortable with .net Framework. It felt more friendly to me so much that I got more into using .net than Java for Home/hobbyist Coding.

The next update for Visual Studio is coming and C# interests me. The supposed better loading times and modularity is something I want to test. When I tried Visual Studio 2017 RC, I liked the installation process and the UI changes on the debug tool and start page. I don’t normally advocate everyone to try the new version of an IDE quickly but Visual Studio 2017’s visible improvements makes me recommend it for hobbyist coding.