100Topics.net

C and C++

           


Home > Computers & Tech > How-To's and Tutorials > Programming > C and C++

TOPICS

Handling Keyboard Input In Win32

(Personal note: I am a physics teacher and a hobby programmer. Since I doubt anyone here is interested in a physics tutorial I figured it would be better to write a tutorial on something I learned while programming.) What I will cover here may be considered something of a lost art since keyboard control has been largely replaced by the use of the mouse. A lot of users are bewildered by the keyboard and the effort of deciding which one to push. Therefore, point and click has come to be consi

....know more

Writing ISRs (Interrupt Service Routines)

[size=5][font="Book Antiqua"]Writing Interrupt Service Routines(ISR s)[/font][/size] It is assumed in this tutorial that you have knowledge of the C language. Although something about pointers is mentioned but this is NOT a C language tutorial. So here we go. [b] The Basics[/b] Many functions of the computer are performed by use of interrupts. These include the typing, printer, task switching etc to name some of them. Now how does these things happen? We are here to answer some of these quest

....know more

[tutorial] Basics Of C Programming - Part 2

Ok, well here is the Second part of the tutorial i promised. [u][size=3][color="#000099"][b]Operators & Expressions in C [/b][/color][/size][/u][size=3][color="#000099"][color="#006600"][u][b][size=2]Introduction [/size][/b][/u][/color][/color][/size][list] [*][size=3][color="#000099"][color="#006600"][size=2][color="#996633"]In c the variable, arrays or function references are combined with operators to form expressions.[/color][/size][/color][/color][/size] [/list][size=3][color="#00009

....know more

Basic C++ Language

[i]You will need [b]passion[/b], [b]devotion[/b] and even [b]obsession[/b] to really appreciate C++ Programming.[/i] [b]Lets grab a compiler[/b] If you have a C++ Compiler then you are all set for turning your C++ code into executable files, if you do not then I recommend getting [url="http://bloodshed.net/dev/devcpp.html"]dev-c++[/url]. To learn more about that compiler I recommend browsing their site. [b]First Program - number.cpp[/b] So now I'm going to write up our first program to

....know more

C/c++ -gdb Linux Debug Tool

[b]To run the C/C++ file use[/b] $ gcc –g –o test sample.cpp To debug the code use following command $[b] gdb test --- you will get following messages [/b] GNU gdb Red Hat Linux (6.3.0.0-1.122rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolut

....know more

C++: Basic Classes

This tutorial assumes that you have a basic knowledge of C++. You know how to use built-in types, like ints, doubles, chars, etc. You should know some types that are part of the STL, like vector, etc. Those types that come in the STL are just C++; you can create your own types just like those! Non built-in types are referred to as [b]classes[/b]. To create a class, you just use the keyword [i]class[/i], the name of the class, and curly brackets. [code]//A class named MyClass class MyClass

....know more

Did I Install A C Or A C++ Compiler ?

If you already had the same problem I just experienced, you should probably be interested by this trick. I just installed a compiler, and I wanted to know if I installed the C and the C++ compiler, or only the C compiler. The answer is simple : let's use small sample programs. Everybody know the well-known "hello" world C program, it compiles with a standard C compiler. [code]main () { printf("Hi, Folks, what s new"); }[/code] And here is a sample C++ "

....know more

More Advanced C++

This example assumes you already know basic c++ functions and classes. it is by no means a complete c++ tutorial, but should give you a good idea of the power of c++. In this tutorial, i will be using virtualisation, abstraction, and polymorphism to draw a simple picture. the code is not complete, because i dont want to tie it into any specific operating system. i will use onlt standard template library finctions, and graphics requires the use of OS specific API's/ We are going to write a

....know more

Sorting A String Vector

I did this code for a reason... It was a school project... I could not find this info anywhere... Maybe it will be use to some1 else. [codebox]#include <iostream> #include <vector> #include <string> using namespace std; int main() { int count=0; vector<string> Names(2); Names[0]="Alexa"; Names[1]="Alexc"; Names[2]="Alexb"; cout << "Before\n\n"; while(count<=2) { cout<<Names[count]<<'

....know more

Basic C++ Coding

Hi everyone today i am going to teach you a very simple program and how it is made. I wont get into anything fancy right now but will teach you how to run a program in the command prompt. ok first if you want any comments in you program code there are two ways to do this. first one i will show you is a block comment. /* This opens the comment you can have as many lines as you want in a block comment this is how you close a block comment */ Okay the second way is a line comment // A line comme

....know more

Handling Errors To Help You In Debugging

One of the most important programming tasks is learning how to handle errors in a way that will be helpful to your debugging efforts. In today's programming we make extensive use of libraries and other code written by other people. When this code generates errors they can be rather hard to track down, since they usually generate exceptions which are caught out of your typical code sequence. In order to deal with this, I want to suggest three error handling ideas, that you can use without re

....know more

Learning C++

[code]// Program to check whether the given string is palindrome or not using library functions #include<iostream.h> #include<string.h> int main() { char str[80],temp[80]; cout<<"Enter string to check \n"; cin>>str; strcpy(temp,str); strrev(temp); if(strcmp(str,temp)==0) cout<<"\n Given string is palindrome"; else cout<<"\n G

....know more

The Holywood Principle

[b][u]Welcome to Hollywood: Don't Call Us, We'll Call You[/u][/b] It is a little appreciated fact that a class presents two APIs: one to its callers and one to its subclasses. Presenting a coherent, easy-to-use, and hard-to-misuse [ACRONYM="Application Programming Interface"]API[/ACRONYM] to subclasses is tricky but important. The "Override and Call-Inherited" idiom is commonly found in Object Oriented [ACRONYM="Application Programming Interface"]API[/ACRON

....know more

Basic C++ Event Handler Class

Hey everyone, I'm going to teach you how to make a simple event handler in C++. If you happen to be familiar with C#'s event handler system, this is going to mimic that. I got the idea from a tutorial on how to make this same class in Python, but I couldn't find anything comparable to it in C++. Plus, it might be useful to someone... Anyway, on to the code. I would recommend basic knowledge of generic classes, operator overloading, and the concept of function pointers. If you don

....know more

Low cost web hosting