~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Tags are not what I aim for, I aim for growth and evolution

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Be like that - 3 doors Down.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

girl? wtf?
jesus

cout << "i Am MALE"<<endl ;

:eek:

Heh...it was a Christmas joke....:D
Merry Christmas :twisted:

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Deeds are what that matter in our short life span

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get Hitler

I put in a sword

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

trousers -> shirts

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

My bomb creating methods destruct with many TERRORISTS.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

try to come

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I can't believe you're using new without delete[].

The point of the above post not being to teach Mr. WaltP how to use new and delete, but to prove my point...;)

How are you a moderator again? Ha ha.

And how are you not a moderator again ?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

No. You probably want:

City* map[200];    // declare an array of pointers

...

    for (int ii=0; ii<200; ii++)
    {
        map[ii] = new City;    // load each pointer with a structure
    }

It is? If so, I stand corrected. I've never seen it done that way.

If it is about the semantics, then yes I agree, what I presented is not array of pointers, but if going implementation wise, both the solutions are the same. But mine with less overhead since the constructor is not getting called in the loop.

Just an example of pointer being used to emulate an array...

An eg.

#include <iostream>
#include <string>
using namespace std ;

struct City
{
    string name ;
    int visit ;
} ;

int main( )
{
    cout << endl << "~s.o.s~'s method" << endl ;
    City* map = new City[3] ;
    for( int i = 0; i < 3; ++i )
    {
        cout << "Enter name: " ;
        cin >> map[i].name ;
        getchar( ) ;
    }

    for( int i = 0; i < 3; ++i )
    {
        cout << map[i].name << endl ;
    }

    cout << endl << "Mr. WaltP's method" << endl ;

    City* mapWalt[3] ;

    for( int i = 0; i < 3; ++i )
    {
        mapWalt[i] = new City ;
        cout << "Enter name: " ;
        cin >> mapWalt[i]->name ;
        getchar( ) ;
    }

    for( int i = 0; i < 3; ++i )
    {
        cout << mapWalt[i]->name << endl ;
    }

}

My output:

~s.o.s~'s …

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Oh you talking about the OP... Yes he was partly wrong in asking the answers -- partly because he was asking for the solutions to the previous year's papers.

Here normally, people try and solve as many previous papers as possible, so as to get the jest of the test and a feel of it. Then extract the same kind of questions from the text book and practice those ones which carry more weightage...

A very complicated reasoning but this is how things work here....:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

One important thing in programming is to learn to evaluate your own code by writing it down and testing it with the help of the compiler.

Does the code which you pasted give you any errors ? No, then you are right atleast for the time being. Keep experimenting and you would learn two fold than what you are learning now.

And btw, yes your code is fine for the time being.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Good girl....;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

panto -> pantaloons

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

With the normal rock band instruments, yes they have a Western sound, but the main or strong points about Indian / Pakistani bands is their lyrics...

Alas you don't understand the lyrics, otherwise you would have enjoyed the song a lot more since the lyrics form the core in our culture.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

movie -> theatre

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

My BOMB creating methods destruct with many buildings.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

My RIOT creating methods destruct with many people

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Christmas day -> Santa Claus

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Do, to piggy back on the answer by Mr. ~s.o.s~ :mrgreen: you should probably just declare the map as City map[200]; . That would fix your problem.

I also hope this line is not in your header file. It should be in your code file only.

Bleh..I wrongly assumed that the project required him to dynamically allocate memory, otherwise would have told him the simple fix :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You still haven't incorporated all the changes proposed to make your program from a working program to a better or portable program....

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Few points:

  • Don't use void main( ) , use int main( ) since main always has and always will return int according to the standards.
  • Don't use old style of header inclusion i.e. the .h notation. Instead use #include <iostream> followed by using namespace std ;
  • As far as your errors are concerned, they are due to the fact that you have forgot to close your if stmts . Each if stmt must have a complementary else stmt.

What you have is

if( some_condition )
{
    // stmts 

     else
     {
      // some_stmts
      }
}

// which should actually be like:
if( some_condition )
{
      // stmts
}
else
{
     // some stmts
    
     if( another_condition )
     { }
}

But there is a better way of doing things using the else if stmts.

if( some_condition )
{
    // stmts
}
else if( another_condition )
{
    // stmts
}
else
{
    // stmts
}

I hope you catch the drift...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

When you are doing City* map[200] , map is an array of 200 pointers to the type City. So in order to access the members of the City struct using its pointers you need to use the -> operator.

Here are the two ways you can do it:

*map[i].visits = 100 ;
// OR
map[i]->visits = 100 ;

But, even if you do so your program won't work. Why ? Because you are not allocating memory to the pointers so acutally what they are poniting to is junk i.e. memory which doesn't belong to you. Consider allocating memory to the pointer before using it in your program.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get the bassist of RHCP

I put in a calendar.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Sky dive -> exciting

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

My chaos creating methods work with many PEOPLE.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a stapled resignation of mine.

I put in a drum stick.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Learning to drive -> Learn to fly

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

My chaos CREATING theories work with many conditions.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hagrid -> Ron Weasley

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a Linux Penguin

...

------------------------------
neither could mine ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Harry Potter -> Hogwarts

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Our chaos handling THEORIES work with many conditions.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

>>enterance papers

What are these? You mean students in India have to take a test in order to advance to the next grade ?:eek: And why would you want the solutions to some previous year's test? I would think you would want the solution to the next year's test. This is realllly confusing:confused: :confused: :confused:

Yeah we have to take a sucky test just to prove that we really have a desire to learn...:(

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Small things lead to big contributions.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get James bond revamped.

I put in some cotton.

PS: Didn't you forget something ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Our CHAOS handling measures work around many conditions.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

If anyone out there is interested in Indian / Pakistani music but wondered what to search for or where to look for it, I would be posting some links.

To start of here is Ek din aayega(a day will come) - by JAL.

http://www.youtube.com/watch?v=oz-D1R4nUUo

If you like the song just post so I will know when to post more links.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Good to have you here buddy, just head over to the C++ forum and feel free to ask any questions.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there buddy, welcome to Daniweb. :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

i need computer graphics programs written in c..
thanks a lot..:sad:

You can get started by using API's like DirectX or OpenGL.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get lots of love.

I put in a spy.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Our apocalypse handling measures work with many CONDITIONS.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a meme (you - me)

I put in my wallet.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Our apocalypse handling MEASURES work around many errors.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Foolishness is found in abundance in this world.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there Eddie, welcome to Daniweb....:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It is worth noting that though those two things ( <typename T> and <class T> ) are interchangeable in most of the cases there are some senarios where you must use <typename T>.

Eg. Suppose you want to create a templated class with something like this:

template < class T, T::member> struct ABC { // }

This actually won't work since in templated class you are passing the type and then the member of the same type. So in such cases <class T> won't work.

You can do somethings like:

// correct
template < class T, typename T::member> struct ABC { // }

//correct 
template < typename T, typename T::member> struct ABC { // }

//incorrect since the compiler won't come to know that T::member
// is a type.
template < typename T, T::member> struct ABC { // }
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a free kick.

I put in some coffee beans.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

fictious -> novels