Agni 370 Practically a Master Poster Featured Poster

pick up a c++ book for beginners and start over...

Agni 370 Practically a Master Poster Featured Poster

you can open a text file and write into it. that shd work i guess.

Agni 370 Practically a Master Poster Featured Poster
class Movie{
private:
string director,title,genre;
public:
Movie(){
director="";title="";genre="";}

int main(){
Movie a();}

I am having problems with my default constructor. my program compiles but it gives me a warning "warning C4930: 'Movie a(void)': prototyped function not called (was a variable definition intended?)" and if i try to run say d.setTitle("test"); it gives me an error of class/struct....what am i missing? i have been staring at this for hours now.

I think its happening because you're not declaring and independent variable of type Movie. if you say 'Movie a' instead of 'Movie a()' you will not get that warning.

Agni 370 Practically a Master Poster Featured Poster

yeah.. i can do this ...

and thanks vijayan for the links .. i'm going through them...

Agni 370 Practically a Master Poster Featured Poster

HI,

I am still new in this language. i would like some help. i need to write a program that finds an avarage marks of "y" students by rerunning and terminating the program. i need this in a 2 dimensional array to store a roll number and marks of the "y" number of the students. it should include array of pointers, call by value and call by reference.

my main problem is to combine all these in one program.
give me the codes and an explanation on calling by value and reference.

your help will mean alot to me. thank you.

As far as writing the code is concerned i'm sure you can do that on your own i can try and make you understand the concept of pass by value and reference in as simple terms as possible..

pass by value occurs when you pass the copy of entire object as a function argument. thus you will be creating an entirely new object and whatever changes you make to this new copy in your function will not affect the original object.

pass by reference occurs when you dont pass the actual object but only address of the object. Thus whatever chages you make to the object will change the actual object.

void
Base::MyFunc(int& val)    //pass by reference
{
	val = 10;
}

void
Base::MyFunc2(int val)    //pass by value
{
	val = 10;
}

int main()
{
   int val = 5;
   Base().MyFunc(val);
   cout << val << …
Agni 370 Practically a Master Poster Featured Poster

First of all the performance for a piece of code can be measured by the time it takes and the memory it cosumes. I've been working on code optimization and memory management for over 8 months now and i've come up various scenarios how performance can be improved.

Myth

  • Memory( RAM ) operations are fast.

Its only true to an extent. I have come in situations where having data in my hard drive and accessing it is much faster. Having huge data in RAM will result in more page faults and thus reducing performance.

So the trick is to use the right data structure. Believe me having the right data structure will improve the efficiency of your code by a huge margin.

Time it takes?? so u mean i should probably start and stop a timer to check which particular approach takes less time, assuming that the time difference is too small to b noticiable manually..? can u give me some references that u've been using? How do i test which data structure is proving most efficient for my application?

Agni 370 Practically a Master Poster Featured Poster

use >pstack core

Agni 370 Practically a Master Poster Featured Poster

Hi,
i have seen a lot of ppl say things like, 'this piece of code is more efficient than the other', 'this gives better performance' or 'more efficient memory wise' etc.. but i fail to understand that how in a normal coding scenario can i find out the efficiency of a code? .. i'm not talking about the very obvious scenario's which are already written down in books or journals.

r there any techniques to find out the performance/efficiency/memory map of a c++ program?


thanks
chandra

Agni 370 Practically a Master Poster Featured Poster

Hi, i'm a c++ programmer and for the first time i had to do some xml parsing in my code. i have been able to do that succesfully using the xercis library, fetching the value of each tag from an input XML file, however my concern is that what if tomorrow the client decides to add a new tag to the i/p XML or change it in any sort of way? does that mean that i will have to revisit the code and add a condition for the new tags? cant i read the i/p xml tags dynamically and fetch the value so that no matter what the xml is i dont have to change the code?

thanks in advance
chandra

Agni 370 Practically a Master Poster Featured Poster

hi... i'm a c++ developer n mainly looking to enhance my knowledge through this forum ....

-rajat