Brian's Bumblings

Monday, January 02, 2006

Testing RTF to HTML Auto Formatter

Testing RTF to HTML Auto Formatter

// myfirst.cpp--displays a message

#include
<iostream>
int
main()
{
using namespace std;
cout << "Come up and C++ me some time.\n";
cout << "You won't regret it!" << endl;
return
0;
}

Not to shabby, but because it's using margins for indentation it doesn't work in the xml feed. I think I will try tweeking the RTF to HTML Auto Formatter code.

Testing Blogger for Word

Testing Blogger for Word for Code Posts

// myfirst.cpp--displays a message

#include <iostream>
int main()
{
     using namespace std;
     cout << "Come up and C++ me some time.\n";
     cout << "You won't regret it!" << endl;
     return 0;
}

Sunday, January 01, 2006

myfirst.cpp

For the next few posts I will be looking at the difference between Listing 2.1 myfirst.cpp from C++ Primer Plus and a similar C# app.

Listing 2.1 myfirst.cpp
// myfirst.cpp--displays a message

#include <iostream>
int main()
{
   
using namespace std;
   cout <<    "Come up and C++ me some time.";
   cout << endl;
   cout << "You won't regret it!" << endl;
   return
0;
}


The closest C# app I could write looks like this.
Listing 2.1-C# myfirst.cs
// myfirst.cs--display a message

using System;
class
MyFirst
{
   static int Main()
   {
      Console.Write(
"Come up and C# me some time.");
      Console.Write(Environment.NewLine);
      Console.Write("You won't regret it!" + Environment.NewLine);
      return 0;
   }
}


The next few posts will look at the following elements of myfirst.cpp vs. myfirst.cs
  • The main() vs. Main() Function
  • Function Headers
  • C++ vs. C# Comments
  • #include vs. using
  • Namespaces
  • cout vs. Console.Write()
  • C++ vs. C# Coding Style

Saturday, December 31, 2005

Posting Code

Many of the posts I will be writing will likely have code snippets contained in them so I need to find a good way to convert from code (C++, C# and others?) to html. I am looking for a good tool that emulates Visual Studio 2005's style. Any suggestions?

I am starting with Carlos Aguilar Mares' CodeColorizer. It does an ok job, but some of the colors differ from VS 2005. Here is a screen capture from VS 2005:



And the code looks like this from the CodeColorizer:

// myfirst.cpp--displays a message

#include <iostream>
int main()
{
    
using namespace std;
    
cout << "Come up and C++ me some time.\n";
    
cout << "You won't regret it!" << endl;
    return 
0;
}


We will see how this works out.

B

C++ Primer Plus

The book I am using as an introduction to C++ is C++ Primer Plus (Fifth Edition) by Stephen Prata. I am not too deep into the book so I have not yet formed my own opinion on the book. I can only go off of the reviews of readers on Amazon who's average rating is 5 Stars. As I work through the book I will try to draw comparisons between C++ and C#. I am sure that I will make mistakes so please correct me when I am wrong!

B

Hello World

...And with any good developers first post I will start with "Hello World."

It is my hope that over the next few months (years?) I will be posting about my journey learning C++ from a C# developer's point of view. I have been developing using C# for the past 3 years and before that was programming using FORTRAN. I am by no means an expert with C# or .NET. I am surely not an 31i+3 hax0r (I can't even figure out how to type h@x0r without blogger.com thinking I am trying to write a mailto: link to h @ xor, nice!) Needless to say making the leap to a non-garbage collected language may be a bit of a struggle. I hope this blog will help me solidify what I learn in this process as well as correct my misconceptions and misunderstandings through comments, replies, berating, and the like. I hope in the end it may help someone else in my position.

B