guys iam new to c++ ,i even dontknow what are the tools to use develop c++ aplications so if sny body know tools like that (c# MS visual studio,java netbeans) pls let me know.
and ma problem is i need to creat a link list on c++ .and i googled it and foung a method to creat a link list.so can any body tel me dose my aproch of creating a link list is correct or wrong.

creating a link list,,,,,,,,,,,

struct node {
string name[30];
int age;
node *nxt;
} ;

inserting values to link list

addValues ()
{
one = new node;
cout<<"plz enter ur name:";
cin>>one->name;
cout<<"plz enter age:";
cin>>one->age;

}

finish...

>>i even dontknow what are the tools to use develop c++ aplications

Then you are going to have a hard time creating a linked list and understanding what you are doing. The tools you are going to need have nothing to do with C# or Java, they are alternative languages to C++. MS Visual Studio contains a version of a C++ compiler/linker/debugger/etc organized into a integrated development environment (or IDE) put out by Microsoft. You can use Microsoft Visual Studio to create programs using the C++ language. The language constructions you are going to need to create a linked list and make it useful include variables, functions, pointers, dynamic memory and user defined types. Copy and pasting code using these constructs from some other available project isn't going to increase your knowledge of C++.

In terms of the snippet posted declaring a user defined type called node, yes that snippet could be used to create nodes in a linked list with each node containing 30 strings in an array of strings called name, an int called age and a pointer to the next node in the list. If the goal is to have a single name and age in each node, besides the pointer to the next node, then the code is wrong.

The snippet describing the function addValues() is lacking a return type, doesn't declare the type of the variable called one and doesn't address the new node's pointer value, which I would make NULL for now. Assuming one is declared someplace else as a pointer to type node, and it remains in scope in addValues, then the snippet just creates and gives value to a new node, but it doesn't add the new node to a list anywhere.

i am using ms VS team system 2008 and there is no any option cold develop the application using C++.

in mine have only 2options .
1c#
2 visual basic

so how to creat a simple console application on c++usiing VS

Visual Studio without C++, interesting. Well, I would go back to the Microsoft website and download Visual C++ 2008, Express Edition. It is free. Then you'll have the software to write programs using C++ language plus separate software to write programs using the C# and Visual Basic languages, when, and if, you ever have to/want to write code using one of those two languages.

i tryed on it but the file downloading proces is geting time.so i ignore it and now iam re instaling VS tS 2008

C++ DEVELOPMENT APLICATION PROB IS OOK. N now i need to get the corrective answer for this link list

Why the need to jump into C++ by creating your own linked list? There is a prewritten list class in the standard template library that should be included in Visual C++ 2008. It would certainly be a strange thing to write a list as your first program without any knowledge of pointers, user defined lists, etc.

Having said that I think of a list as a collection of information stored in memory sort of like a treasure hunt. You go from one place to the next given information stored at the place where you are. In lists you store the memory location of the next set (and previous set if the list is doubly linked instead of singly linked) of information in the list at the current location, so you always know where to go next. Nodes are a common name for each place you stop on the journey. In singly linked lists you have to know where the first node is to get to all the rest. (In doubly linked lists, you can get wherever you want to go by knowing any nodes address, but almost always it's the address of the first node that you know).

To add nodes to the list you need to know what protocol you are going to use. Sometimes you always add to the front of the list. Sometimes you always add to the back of the list. And sometimes you add to the interior of a list, though it could be to the right or the left of one of the nodes.

struct node 
{
   string name;
   int age;
   node * next;
} ;

//this function will always add a new node to the end of the list
//head is a node pointer with the address of the first node in the list
void addValues (node *& head)  
{
   //create a new node and and populate it's members
   node * one = new node;
   cout << "please enter a name:";
   cin >> one->name;
   cout << "please enter an age:";
   cin >> one->age;
   one->next = NULL;
   
   node * current = head; //don't lose track of head
   if(current == NULL) //empty list
      head = one;
   else
   {
       //find the last node of the list
       while(current->next != NULL)
          current = current->next;
       
      //store the address of one in the last node of the list, effectively making one the last node of the list.
      current->next = one;
   }
}

Given the information you've provided so far that should be enough to create and populate a list. The code hasn't been tested for accuracy, but I stand by the principles involved. In addition, it may not be what you want, but until you provide more detailed information it is one way to create a list wherein each node has a name, an age and the address of the next node in the list.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.