Topics Search

C and C++

Home » C and C++ (739)

Exploring the C++ Generics Programming Model

Exploring the C++ Generics Programming Model Icon
C++ generics provide a powerful way to create an extensible design with the help of templates. The primary motivation of any generic model of programming is that it enables the programmer to develop components that provide easy and seamless transition from the design to the application code. It also better expresses design intention and highly supports the reuse of design structure with minimal recoding. A sense of the generic pattern also can be achieved through other means, such as polymorphism and virtual classes, void objects, and so forth, which simulate a flavor of generics by providing multiple service with a single interface, but they are quite different from templates.

C# Async Await Revisited

C# Async Await Revisited Icon
For those of you who have been using C# for some time now, you've no doubt come across the use of the Async and Await keywords for asynchronous programming and probably made extensive use of them yourselves. If you're new to the language, asynchronous programming in the language—today—finds these keywords at its core. They make writing asynchronous methods very easy; those methods look very similar to their synchronous counterparts, and are almost as easy to read.

C# Programs to perform basic arithmetic operations

C# Programs to perform basic arithmetic operations Icon
The basic arithmetic operations are addition, subtraction, multiplication and division. Here are the C# programs which can be used to perform the basic arithmetic operations on two numbers belonging to 'int' datatype.

C#.Net UDF Using Excel-DNA And Visual Studio

C#.Net UDF Using Excel-DNA And Visual Studio Icon
In this post I’m specifically targeting Excel VBA developers with little or no experience of .Net so following the steps below should be easy and will cost you nothing more than your time. First of all, you need to download and install Visual Studio.

Introduction to testing your code

Introduction to testing your code Icon
So, you’ve written a program, it compiles, and it even appears to work! What now? Well, it depends. If you’ve written your program to be run once and discarded, then you’re done. In this case, it may not matter that your program doesn’t work for every case -- if it works for the one case you needed it for, and you’re only going to run it once, then you’re done.

DateTime and Null value in C#

DateTime and Null value in C# Icon
Assume that you want a variable of type DateTime and you would like to have the uninitialized value or null value , you can use the nullable DateTime type. When you define a DateTime variable and dont initialize it , the default value is the DateTime.MinValue. You can simply define the type as Nullable DateTime as shown in the code snippet.

Implementing an MVC Model with the Qt C++ Framework

Implementing an MVC Model with the Qt C++ Framework Icon
MVC began as a framework in SmallTalk, which became so popular and widely used that the character exhibits semblance to many software engineering principles as it evolved. This is a particular interest of study for the software engineering purist. Here, we begin with intuitive understanding of MVC to its actual implementation in the Qt C++ Framework.

Intro To Particle Swarm Optimization

Intro To Particle Swarm Optimization Icon
Particle Swarm Optimization (PSO) is a novel way to optimize a problem over a series of steps to find a solution to a measurable problem. That is to say you have a solution goal, a given set of unknown blocks that make up that goal, and you want to find the pieces that fit for that goal. A set of 'particles' (widgets, objects, etc) are given values (position), and are converge (velocity) to a local and global best solution each iteration.

C++ Association

C++ Association Icon
In this lesson, we’ll take a look at a weaker type of relationship between two otherwise unrelated objects, called an association. Unlike object composition relationships, in an association, there is no implied whole/part relationship.

C++ Dependencies

C++ Dependencies Icon
So far, we’ve explored 3 types of relationships: composition, aggregation, and association. We’ve saved the simplest one for last: dependencies. In casual conversation, we use the term dependency to indicate that an object is reliant upon another object for a given task.

The New LINQ Fundamentals

The New LINQ Fundamentals Icon
The first course I ever made for Pluralsight was a LINQ Fundamentals course in 2008. I’ve received many great bits of feedback about the course over the last 8 years, but I’ve also learned a few things about teaching, presenting, and making courses during that time, too. Whenever I’m forced to listen to a clip from this early course I cringe. I sound like my speech was addled by sleeping pills and vodka.

Interfacing MySQL Connector/C++ with the Qt Framework

Interfacing MySQL Connector/C++ with the Qt Framework Icon
MySQL Connector/C++ is an object-oriented database API library to work with MySQL database and C++. The API is partly built upon the JDBC 4.0 API specification. As a result, the C++ class names and functional interfaces are same as we use in JDBC programming in Java. MySQL already has a C-style native API library and the problem is that, to fit it with the C++ paradigm, one has to manipulate using cryptic code. MySQL Connector/C++, on the other hand, is purely object-oriented, backed by a well-designed architecture. On the C++ GUI framework, C++ has a variety of options for creating a cross-platform GUI interface.

Explore Constructors and Destructors in C++

Explore Constructors and Destructors in C++ Icon
C++ programmers have two basic responsibilities: one, allocate memory for variables defined and two, deallocate the space gracefully once it is no longer used. It is not difficult to guess what havoc it can cause when unused memory is not freed up properly. Unlike other high-level languages like Java, which has its own garbage collector to do the clean-up job, C++ is not that kind. Here, it is completely at the discretion of the programmer who solely decides how efficiently the memory may be used.

C++ Object relationships

C++ Object relationships Icon
Life is full of recurring patterns, relationships, and hierarchies between objects. By exploring and understanding these, we can gain insight into how real-life objects behave, enhancing our understanding of those objects.

C++ STL Functors

C++ STL Functors Icon
STL includes a set of template classes that overload the function call operator (operator ()). Instances of those classes are called functors or function objects. Many algorithm functions in STL take those functors as input and apply them on the elements they operate. STL has two kinds of function objects: Unary Functor: Functor that can be called with one arguments

C++ STL Iterators

C++ STL Iterators Icon
Iterator is a concept of objects which can be used to traverse through the elements of a collection of objects like STL containers. An iterator object can point to an element within a range of elements and provides a mean to move the pointer through other elements within that range using operators. An iterator must support at leas increment operator (++) and dereference operator (*). There is no single type of iterators. Pointer is the most simple and obvious form of iterators which can point to any element of an array and can iterate through the array of elements using increment (++) and decrement (++) operators.

Reactive Programming with C#

Reactive Programming with C# Icon
We will see a practical example of what is reactive programming with pure C# coding. Reactive messages flow by a producer and a consumer and subscribe for some messages. The IObserver C# interface is available to construct message receivers that comply with the reactive programming layout by implementing the three main message-oriented events: a message received, an error received, and a task completed message.

Database Programming with C/C++

Database Programming with C/C++ Icon
Creating a database application in C/C++ is a daunting task, especially for a novice programmer. Although the actually code is quite simple, it is the configuration issues such as importing right library, drivers to use, how to access them, and so forth, that make it an uphill battle. Modern high-level languages are pretty straightforward in these matters. They are quite simple and convenient with an all-in-one-place library with very few configuration troubles. One of the interesting aspects of using a high-level language is that you can almost start coding with even a little understanding of the underlying principles.

Explore the Intricacies Involved in Compiling C/C++ with GCC

Explore the Intricacies Involved in Compiling C/C++ with GCC Icon
There many C/C++ compilers available on the market. Many of them are free. GCC, or GNU Compiler Collection, is one of such compilers commonly found in a Linux system (Windows and other platforms). It is a product of the Open Source movement pioneered by Richard Stallman. However, GCC per se is not a single compiler, but an integrated collection of compilers for several major programming languages such as Objective-C, FORTRAN, Java, Ada, and so forth, including C and C++.

Beginning C#: Boolean Logic

Beginning C#: Boolean Logic Icon
In our last installment, I showed you how to use a basic IF/Then construct to make decisions in C#. This time, we're going to take that one step further and take a look at Boolean logic, helping you to make some very advanced choices in your code.
Home » C and C++ (739)