Read Latest Entries..: (Post #17) by nirmal_1288 on Jun 8 2007, 06:27 PM. (Line Breaks Removed)
Friends those who are good in c++ please help me in this problem if u have suggestions let me know it...I have two classes, call them class1 and class2. In my main(), I declare a new class object: class2 stepping_action = new class2;stepping_action has a variable called "contained" that is a boolean. What I need to do is change the value of this variable from within class1. When I try, i... read more.
You might also want to explain how that's simple. There's no way a newbie to C/C++ could get through that as it is. I myself learned the conditional operator after operator overloading.
Oh yeah, and you're missing a label for everything as "C++" and the use std commands. Gets errors on ANSI-strict compilers such as Dev-C++
Oh i do have some graphics tutorial for beginners on my website that is hosted on computing host.at http://onecore.net if you need some help with program plesae pm me.
@mahesh2k: Aww... only Turbo C++ graphics stuff? I'd love to see some stuff we all use. (*cough* gcc *cough*) Or maybe it's just that this internet connection's slightly rickety right now and I can't find the other C++ graphics tutorials.
However, nice site. I look forward to checking it out when I have time.
man i dont onderstand c++, if you want a beginner to understand Your tutorials coukd you please add some comments to them that would really help us thaks,
i am a newbie at c++, but i think easyc is the best begginer program for programing. playing around on that really help me to understand c++ programing
Friends here i am to explain to u abt writing a simple C++ program -Hope this will be useful to u ...
Every C++ program contains one or more functions, one of which must be named main . A function consists of a sequence of statements that perform the work of the function. The operating system executes a program by calling the function named main. That function executes its constituent statements and returns a value to the operating system.
Here is a simple version of main does nothing but return a value:
int main() { return 0; }
The operating system uses the value returned by main to determine whether the program succeeded or failed. A return value of 0 indicates success.
The main function is special in various ways, the most important of which are that the function must exist in every C++ program and it is the (only) function that the operating system explicitly calls.
We define main the same way we define other functions. A function definition specifies four elements: the return type, the function name, a (possibly empty) parameter list enclosed in parentheses, and the function body. The main function may have only a restricted set of parameters. As defined here, the parameter list is empty; Section 7.2.6 (p. 243) will cover the other parameters that can be defined for main.
The main function is required to have a return type of int, which is the type that represents integers. The int type is a built-in type, which means that the type is defined by the language.
The final part of a function definition, the function body, is a block of statements starting with an open curly brace and ending with a close curly:
{ return 0; }
The only statement in our program is a return, which is a statement that terminates a function.
Friends those who are good in c++ please help me in this problem if u have suggestions let me know it...
I have two classes, call them class1 and class2. In my main(), I declare a new class object:
class2 stepping_action = new class2;
stepping_action has a variable called "contained" that is a boolean.
What I need to do is change the value of this variable from within class1. When I try, it tells me that stepping_action is not in the right scope. I have tried declaring stepping_action outside of the main but I still get the same error. How can I change this variable from class1?
I am working on a C++ program that converts a decimal to a fraction, finds the lowest common multiple, multiplies the numerator by the denominator, then reduces the fraction again so the fraction will be 'numerator/1'.
I am using this code in a larger program to change a floating point slope value to a whole value for slope-intercept equations and standard form equations.
The program will run but I tested almost 500 numbers and 20 numbers made the program crash (it stalled and did not finish the equation, I had to close the terminal and open it up again... )
I have tried c-style casting and dynamic and static casting to try to resolve this issue. Can someone help me out and point out why these certain numbers make the program crash and offer a possible sloution?
I tried debugging this program on gdb and keep on getting this frustrating message..
(gdb) break 16 No line 16 in file "init.c". (gdb)
Here is the program's code:
CODE
//example.cc #include <iostream> #include "reduce.h" #include "decimal-to-fraction.h" using namespace std;
int main() { double deci; double n, d;
while(1) { cout << "Enter a decimal to convert to a fraction ('0' to quit): "; cin >> deci; cin.ignore(INT_MAX, '\n'); if(!deci) exit(0);
dec_to_frac(deci, n, d);
if (n * d != n){ cout << '\n' << deci << " = " << n << '/' << d << "\n\n"; cout<<'\n' << d << " x " << n; n = d * n; cout<< " = " << n << "\n\n"; cout<<'\n' << n << '/' << d; reduce(n, d);
cout << " = " << n << '/' << d << "\n\n";
cout<<'\n' << n << "\n\n"; }
else cout<<'\n' << deci<< "\n\n";
}
return 0; }
#ifndef _REDUCE_H_
#error You must include "reduce.h" before this file
Friends do remember this at the begginnig stage of learning C++ . this is regarding the virtual methods.When you have a virtual method, calling it will always call the most derived version of the method. You could however write a method for JSWidget like this:
Know C or C++ -> you know Java (but never use it wink.gif )
Know java -> C++ and especially C is difficult for you because it is more low level than java
So it all depends upon which one you start with, and starting with C is much more advantageous.
C is the standard for programming today, maybe someday it'll be java, but hopefully not! Anyways, you can't really compare C with Java since Java works in a completely different way.
you want to learn C/C++ by yourself?! I took a introductory class on it in hs and thought it was hella hard. I'm sure I'm not the only one...let's say there was a bit of copying going on the programming assignments :lol
Hi any C++ programmer want to share C++ programs,then post the code here.But it would be good if the
programs are not too long.So only short programs. But post that code in bbcodes-don't forget
that. Anyone who doesn't understand any programs that are posted can take any help here in
this thread. Heres one : This is a program using class: CODE #include<iostream.h>
class sum { private: int a,b,c; public: sum() { a=5,b=6; } sum(int x,int y)
{ a=x,b=y; } void get() { cin>>a>>b; } void calc() ....
Hello every one Today I’m going to write good c c++ tutorials The tutorials are mine showing my
experience in c c++ i my be using some examples rote in some books (if i do i will pot a link or
name of the book) And all the tutorials are at the main topic I don’t know how my topic count in
this case because all I’m going to do is updates the same topic Any way lets just tray and see First
sings first in order to compile your code you need compiler That compiler is an application that
converts your code from human readable code to Binary cod or machine code There is all....
first off i would like to announce this is my first time on here, i would like to know what kind of
programs i need to edit my Pc games. i have been learning how to edit with just texts but i would
like to know what i need for the text scripts i can't read? any information can help
--thanks....
This tutorial will show you how to buffer overflow programs in order to change the flow of the
application , even if this means executing your own code. A very well explained tutorial of buffer
overflows ( not theory but practise ) + a 20 min video tutorial/demonstration + all the files needed
for the tutorial.. Buffer Overflow In Action Tutorial LINK ....
ok so I was wondering if anyone knows where I can find a good, c/c++ dummy friendly guide? my main
reason for want to learn it so that I can make .cab files that do registry edits for ppc. I know
this should be easy to do, Any help would be greatly appreciated. Thx in advanced, Mike....
I've been teaching my self C++, slowly but surely. Everything I try to program is just mediocre,
and much simplier to use something already made. How long does it take before I can start
programming useful decent programs?....
Hi, I'm trying to learn assembly but I can't compile any "hello world" programs... And I
don'n know what I'm doing wrong... I downloaded NASM ,NASMW and TASM32. The program is like
this: EXAMP1.ASM: ;title Hello World Program ; This program displays "Hello, World!"
dosseg .model small .stack 100h .data hello_message db 'Hello,
World!',0dh,0ah,'$' .code main proc mov ax,@data mov ds,ax
mov ah,9 mov dx,offset hello_message int 21h mov ax,4C00h
int 2....
There are a number of tutorials available for the intermediate game programmer, but there are very
few good tutorials for beginners who have never drawn a pixel on the screen. A quick search on the
net reveals hundreds of sites devoted to 3D, polygons, texture- mapping and other advance topics,
but the beginner has no where to get started. This tutorial is for C programmers who want to get an
introduction to game programming. find this tutorial at Dos Game Programming in C for Beginners ....
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.