Blogs Blogs

C++ Blogs

Newest Most Active

It’s 5pm on Sunday evening and you decide it’s time to break out your 1st Java assignment, which is due later that evening at 12am. No big deal, you have plenty of time! What can’t you do in seven hours? I mean that’s like at least 40 games of Halo. You stall another hour (playing Halo) until six 0clock at which point you decide you better get started just in case. You glanced at the problem earlier in the week, no biggie. A couple of inputs, some basic processing, some formatted output, and maybe the professor threw in some easy twist. Two maybe three hours tops, you’ll be counting sheep by ten.   The clock strike’s ten; you have 25 IM windows open (3 hopefuls). You’ve Googled the same thing 25 times, you have more red squiggly lines than if you had written a letter in Spanish inside MS. Word, your code doesn’t compile,  and it looks like this…   public class Chaos {       //default constructor public Chaos()    ... read more

INTENTION: You have a basket. You want to add Sandwiches and Sodas while keeping a separate list for each item that are added to the Basket. You don't want the user to worry about two separate functions, addSandwich( ) and addSodas( ). You want to make the "add" easy for the user, so you decide to abstract away the design of your add function. All good.   You derive the Sandwich and the Soda class from a polymorphic Item class and pass that to the add function. ( Note: A polymorphic class has at least one virtual function, usually the Destructor if you can't find another function to do that job for you!)    class CSandwich : public Item {...}; class CSoda : public Item {...} ;   void CBasket::add(Item *pItem){...}   PROBLEM: In your add function, you want to keep track of the number of Sandwiches and Sodas being added. Do you do a dynamic cast to find out during run-time what the user is trying to add ?   void... read more

Update: This post is old and the link is out of date. Rather than read and follow this blog’s instructions, I’d recommend you try to get started with C++.   This post shows you how to get a good, free IDE for C++ and get started writing a program. To get your free IDE: Go to this link: Click the plus sign next to the tab which says Visual C++ 2010 Express. Then click install now. A download should start, then if you are using Internet Explorer click run on the bottom of the screen (if you are using Chrome or Firefox then go to the downloads folder and double click the file named vc_web.exe). The installation should start. Click next. Read the terms, click “I have read and accept the license terms”, and click next. Then click install. (at this point, I stopped the installation because I already have the program so if there are... read more

When using C++ for object-oriented programming, there are some basic concepts and best practices that should be followed for good software engineering. First is the use of public and private in class definitions. Most programmers moving from C to C++ are accustomed to using structs, where all fields are "public" for others to access; in C++, all fields in a class are "private" by default instead. There is a good reason for this: everything in a class should be private unless otherwise necessary. If there is some data that you wish to "expose", you are best off using getter/setter methods to do so rather than making the data public. If some other class needs direct access to the data, make it a "friend" class instead of making the data public. Be smart about which methods are made public as well, and limit the amount of exposure to the "internal workings" of your class. Next is the use of "const",... read more

A struct is a datatype from the C programming language that encapsulates a number of different datatypes into a single object. This can be used to easily handle a set of values as a single "package", while also being able to access the individual members of the structure. One example of this may be a ContactInfo structure that contains a person's first name, last name, e-mail address, phone number, birthday, etc. It's easy to see how this would later be extended into the notion of a "class", where the object could have methods defined to access the data or otherwise manipulate its contents, and even lend its functionality to extensions that "inherit" from that type. C++ added this capability to the "struct" while also providing the more appropriate "class" keyword that does mostly the same thing (with some minor differences, such as the default access for members and methods for a class is private while it is public for... read more

For the past few years, I've spent most of my time teaching and tutoring on physics, but I also tutor students in programming languages such as C, C++ and Java. These languages are three of the most difficult to learn due in large part to their comprehensiveness. These and languages very similar to them are the programming languages used to implement most of the highest performing and functionally complicated applications in the world, including operating systems, office suites, high performing websites and smartphone apps. Prior to becoming a teacher, I put myself through graduate school teaching classes and tutoring mostly college students on programming. I then worked for about 20 years for software companies developing software, leading development and consulting into business on the development of custom, high performance software. I welcome inquiries on tutoring of computer science topics, such as software engineering, software architecture, programming and databases... read more

I have studied Electrical and Computer Engineering and received Master degree in 2008. While I was studying at university, I worked as a teacher assistant. I have taught many courses to undergraduate and graduate students. In addition, I taught a lot of elementary and high school students as tutor. Both of these experiences convinced me to pursue tutoring as a career. Therefore, I have tried hard to become a good teacher. I realized that teacher preparation is the major determinant of a great teacher. I have taught large variety of courses; however, my best experience is computer programming. Right now, I have some college and high school students whom I am teaching Java, C/C++, Matlab, and object oriented programming. I love teaching the computer programming to any student and can transmit information in the best way at minimum time. If you have any problems in programming and want to become ready for your class or doing your homework, I could help you. You are going to... read more

Hello Programmers, For anyone who is interested in programming, where do you start? Well, C++ is a good programing tool. The only thing you need is to download one of the free "C++ compilers" online to run your code. What kind of codes or programms can I write? Well, it's up to you and what you want it to do. It's probably good to start with something easy, and then make one that’s interacting, so you can input data and get cool output. Make an app..! a DataBase, a cool game, etc.. The first Program I’m going to show you is called “Hello Wyzant”. #include iostream using namespace std; void main() { cout << "Welcome to C++ Programming" << endl; cout << "Hello Wyzant!" << endl; } run this program, it should display on your computer the message in blue. Welcome to C++ Programming Hello Wyzant Lesson 1 #include iostream // this... read more

The other day, I helped my C++ professor to derive an equation for a problem we had to do. The problem needed to be programmed into C++. The problem was that there is a man whose car is parked on the railroad track and he had to get off of it as fast as he could. The thing is that he had ran out of gas and was stuck on the track! Even worse, there was a train on the way! Thankfully, the trains horn blares and the man hears the horn. The man is able to get out of the way before his car is destroyed by the train. The man got out of the way just in time! Now, lets think here. What would we need to program this problem into C++? We would need the speed of sound, the man's reaction time, the distance that the train travelled along with the speed of the train. Here is the code I came up with, check it out: /* CS110 Fall 2011 Assignment 4 "Railroad Crossing"*/ #include using namespace std; int main( int argc, char* argv[]) { float... read more

Being my first WyzAnt post, I figured I'd just ponder on a fallacious belief new programmers generally have. But before that, allow me to introduce myself! My name is Jaffer, I am a student at APSU, a senior with a major in Computer Science and a minor in Mathematics. I chose to become a CS major because, well, I love video games and I've always wanted to make them. That is why I really got into C# and XNA, as it makes the life of a game programmer significantly easier. I've used C, C++, Java, C#, Ruby, Fortran, Erlang, F#, VB, HTML, PHP, SQL and who really knows what else, and this is over the course of just 2 years really. So, onto the biggest fallacy a new programmer probably believes: Fallacy: Learning my first language was hard and took a long time (it usually does!). I don't want to learn another language because it will take forever. Truth: Learning a programming language is not about memorizing syntax or semantics, nor is it a test of if you can place each semicolon... read more

Data structures are a way by which data is stored and organized in a system. Linked List, Stacks, Queue, Trees, Hash Tables etc. all come under this category. Best way to learn data structures in any language C, C++, Java etc is to have a pictorial representation of the problem in front of you and then to implement. Syntax of data structure in any language can be easily learned. One need to focus on the meaning of particular data structure and best way to understand this is to have pictorial representations of what exactly needed to be implemented.

Obviously, if you are in a classroom setting, having a cell phone ringing in the middle of a lesson distracts the train of thought for both the instructor and the student. Critics who are against confiscating cell phones, iPods, and other electronics that many elementary and secondary students carry with them to school cite examples of using technology to enhance the process; however, the lack of funding and training for students and teachers to use the technology poses problems in implementing the use of technology in the classroom. What is the point of having computers if teachers do not know how to use them and there are no instructors to teach the students how to use the software? Would it make sense to provide schools with brand new iMacs preinstalled with Photoshop if there was no funding to hire instructors who know how to use and teach Photoshop? Should school districts spend money on providing every school with a cartful of software and computer accessories if there is... read more

Ken B., known as "The Best Little Tutor In Texas", has just surpassed the 400 hour tutoring mark in Houston, Texas! What makes Ken so good and popular in Houston? It is because of his diverse background and of being able to do the following: mathematics, statistics, chemistry, physics, computers, and computer programming. He can help a student in many many different areas. Ken does both high school and college and does regular, honors, IB, PAP, AP, etc... All that is quite a talent. Ken says that the subject most tutored in the past several months is statistics, and the reason for that is that most teachers use the 'dump' method...they 'dump' a copious quantity of power point files onto the student but the teachers do not really teach how to 'do' the problems...he has seen the same trend with other subject areas, and this is most unfortunate for students taking the, if you need to get on top of your mathematics and science courses (except of biology), then Ken... read more

C++ Blogs RSS feed