118 Posted Topics
Re: First of all instead of writing out all those numbers on top i would put it in a loop by using a variable increment that variable and so forth Also to create a book of * use \n and . Make your life a lot easier. Don't have to type … | |
Re: if it a pointer you need to dereference the variable otherwise you are getting the memory location. use *tokens to dereference pointer. | |
SO it says given the follwing relations father (X,Y) says that X is the father of Y mother (X,Y) says that X is the mother of Y female(X) says that X is female male(X) says that X is male Define a sister relation so that sister(X,Y) says that X is … | |
Re: just keep counting every time it encounters a space trying using isspace function I believe that calculates white spaces while(isspace()) { count++; } something like that. | |
Re: [code] template <class KT, class DT> void my_bst<KT,DT>::printLevelOrderAux(my_bst_node<KT,DT>* t, int level) { if(t) { if(level == 1) { printf(" %d ", t->key); } else if (level > 1) { printLevelOrderAux(t->left, level-1); printLevelOrderAux(t->right, level-1); } } } template <class KT, class DT> void my_bst<KT,DT>::printLevelOrder(my_bst_node<KT,DT>* t,int height) { int i; for(i = … | |
Re: use the "new" keyword and have a pointer point to this new data. That's what dynamic allocation is and make the new data an array which can have any size. So may use a variable. | |
basically i have 4 files 2 contain the following data . Trying to find out data which is common and not common in both files and write it out to files common and not common. It almost works except for it doesn't compare the last item in the list before … | |
Re: why are you using a structure? Use object oriented programming with classes lot easier and use recursion. May take more time to come up with but it is easier to understand | |
Here's what i have. Not sure what it is doing exactly. You pack a account object and then you write it to the buffer right? So shouldn't it print after i write it? Main #include <iostream> #include <iomanip> #include "account.h" #include "Lentext.h" #include "Deltext.h" using namespace std; int main() { … | |
[B][COLOR="Red"]a multilevel index using a B-tree is to be made for a file with 600,000 records. A block contains 1500 bytes, a key is 10 bytes, a pointer is 5 bytes and a data record is 100 bytes. [/COLOR][/B] [B]a)What is the order of the tree?(assume tree node=a disk block)[/B] … | |
gives me error on 3rd coded line in search(). [CODE] #ifndef MY_HT_CHAIN_H #define MY_HT_CHAIN_H #include <iostream> #include <vector> #include <list> using namespace std; class my_ht_chain { public: //constructor which creates a table of a certain size my_ht_chain(int initTableSize); //destructor ~my_ht_chain(); //insert a value based on key void insert(int key); //search … | |
Is my understanding of a vector list correct. vector<list<int>>. The vector holds a list of data type int? [CODE] class my_ht_chain { public: //constructor which creates a table of a certain size my_ht_chain(int size); //destructor ~my_ht_chain(); //insert a value based on key void insert(int key); //search for a value based … | |
Do I need a copy constructor? [CODE] #ifndef MY_MIN_PQ_H #define MY_MIN_PQ_H #include <iostream> #include <vector> using namespace std; class my_min_pq { public: //default constructor my_min_pq(); //destructor ~my_min_pq(); //insert element at end of sequence, and rearrange so minimum data at the front of array void enqueue(int data ,int priority); //removes data … | |
we are supposed to implement using STL vector and base it on priority and have have a data value So every time i enqueue i insert an in item into the end of the vector and if no space i modify. So do i reorder the list to place the … | |
Re: you could try using the &symbol before the variable but that might just put in memory location of those arrays. | |
Re: you probably need a factorial function to find 1*2...*k. it should probably be recursive | |
Re: hmmm... for the calendar it depends on whether its a leap year or not. So every time 4 years pass the days that it happens the days change. Don't think that their is a pattern. Write it out for the next couple of years and see or use induction or … | |
i believe that it checks every nodes height and makes sure that the left -right is 1 or 0 or -1. It is supposed to return tree if tree is balanced which means that left-right is 0 or 1 or -1 at every node. [CODE] template <class KT, class DT> … | |
i get a stack error [CODE] template <class KT, class DT> void my_bst<KT,DT>::show_bst_structure() const { my_bst_node<KT,DT>* b=root; show_bst_structure(b,0); } template <class KT, class DT> void my_bst<KT,DT>::show_bst_structure(my_bst_node<KT,DT>*& p, int level) const { int i; if ( root == NULL ) { for ( i = 0; i < level; i++ ) … | |
Here's what I have so far [CODE] template <class KT, class DT> void my_bst<KT,DT>::show_bst_structure(my_bst_node<KT,DT>*& p) const { my_bst_node<KT,DT>* le=NULL; my_bst_node<KT,DT>* ri=NULL; //empty tree if(p==NULL) { cout<<"tree is empty\n"; } else { //print node key cout<<p->data<<endl; if(p->left!=NULL&&p->right!=NULL) { show_bst_structure(p->left); } else if(p->left!=NULL) { cout<<"enter left\n"; le=p->left; show_bst_structure(le); } else if(p->right!=NULL) { … | |
here is my code main [CODE] #include <iostream> #include "account.h" using namespace std; int main() { account a; return 0; } [/CODE] account.h [CODE] #include <iostream> #include "Lentext.h" #include "Deltext.h" #include <string> using namespace std; class account { private: char account_Number[11]; char name[1000]; char address[1000]; char city[16]; char state[3]; char … | |
I was wondering if any one had any suggestions for areas to research which tie with Artificial Intelligence. My interest is AI but since I haven't taken a class in AI. I can't do a project in that. | |
the delete must be by copying the data and then deleting if their are 2 nodes from that one root. CODE IS AT VERY END FOR THAT. CALLED REMOVE. Thanks. main [CODE] #include <iostream> #include "my_bst.h" using namespace std; int main() { my_bst<int,int> ab; ab.insert(4,1); ab.insert(2,2); ab.insert(6,3); ab.insert(1,4); ab.insert(3,5); ab.insert(5,6); … | |
1>c:\users\...\documents\visual studio 2008\projects\generic bst container\generic bst container\my_bst.h(80) : warning C4717: 'my_bst<int,int>::insert_sub' : recursive on all control paths, function will cause runtime stack overflow TEST.CPP #include <iostream> #include "my_bst.h" using namespace std; int main() { my_bst<int,int> ab; ab.insert(5,10); return 0; } MY_BST_NODE.H #ifndef MY_BST_NODE_H #define MY_BST_NODE_H #include <iostream> using namespace std; … | |
Error 1 error LNK2019: unresolved external symbol "public: __thiscall vector::my_vector<int>::~my_vector<int>(void)" (??1?$my_vector@H@vector@@QAE@XZ) referenced in function _main test.obj Error 2 error LNK2019: unresolved external symbol "public: __thiscall vector::my_vector<int>::my_vector<int>(void)" (??0?$my_vector@H@vector@@QAE@XZ) referenced in function _main test.obj Error 3 fatal error LNK1120: 2 unresolved externals C:\Users\...\Documents\Visual Studio 2008\Projects\Iterator and Generic Vector Container\Debug\Iterator and Generic Vector … | |
I have a dynamic array and i am trying to create a iterator class to support the list. I am adding begin and end. As well as a new class. error C2146: syntax error : missing ';' before identifier 'begin' Error 7 error C2146: syntax error : missing ';' before … | |
Don't think you can pass any parameter unless you create a point in your main. [CODE] template<class T> void my_list<T>::show_sllist(my_node<T>* p) { if(p!=0) { cout<<p->data; show_sllist(p->next); } } [/CODE] Would i have to create a pointer of type my_node in main to show the list. [CODE] #include <iostream> using namespace … | |
problem is that it prints out backwards, can't figure out a way to flip it. prolbem is with numbers[siz-1] which begins at last index not first. [CODE] template<class T> T my_vector<T>::show_vector(unsigned int siz) { if(siz==1) { cout<<"enter size of array is 1\n"; return numbers[0]; } else { cout<<"enter this statement"<<endl; … | |
Basically the please hit any key to enter doesn't show up in Visual C++.Thanks for help main //CS 310 /*Create a text file and input in certain data into the text file*/ //Program one #include <iostream> #include <fstream> #include "Account.h" using namespace std; int main() { account b; char name1[256]; … | |
In early linux systems, inodes were kept together on one part of a disk, while the corresponding data was scattered elsewhere on the disk. Later editions divided disks drives into group of adjacent cylinders called cylinder groups, in which each cylinder group contains inodes and their corresponding data. How does … | |
My understand is in generic programming you can have multiple containers, which use iterators but use the same algorithm. Wouldn't template be considered a ADT? Really confused. | |
I would say yes since both are ways of storing information. | |
[CODE] void my_int_sllist::pop_back() { //head and tail pointers cout<<"enter pop_back"; //contains one node if(head==tail) { cout<<"enter head==tail?"; delete head; head=tail=0; siz--; } else { cout<<"enter's other condition"; my_int_node* temp; for(temp=head; temp->next!=tail; temp=temp->next) { delete tail; tail=temp; tail->next=0; } siz--; } } [/CODE] | |
the problem seems to be in the show_int_sllist(). main [CODE] #include "My_Int_Sllist.h" #include <iostream> using namespace std; int main() { //Test1 my_int_sllist b; b.push_back(10); b.show_int_sllist(); return 0; } [/CODE] INTERFACE NODE [CODE] //class used to create a node class my_int_node { public: //member that stores the nodes data value int … | |
When i run a black screen with cursor appears but nothing prints THANKS INTERFACE [code] //my_int_vector.h class my_int_vector { public: //destructor ~my_int_vector(); //copy constructor my_int_vector(const my_int_vector& b); //constructor that create an empty vector my_int_vector(); /*constructor that create an vector with capacity specified as a parameter but doesn't assign values to … | |
I know their are some in C so shouldn't their be some in C++? | |
#include <iostream> #include <stdio.h> #include <fstream> #include <string> using namespace std; int main() { int number_Of_Lines_To_Print_From_End=0; char file_name[20]; streampos length; cout<<"enter file name that needs to be opened\n"; cin>>file_name; cout<<"enter number of lines to print from end of file\n"; cin>>number_Of_Lines_To_Print_From_End; fstream file; file.open(file_name, ios::out ); if(file.is_open()) { cout<<"the file opened\n"; … | |
In unix if you create and open a file by using 9 digits numbers in the open function it seems to work but in C++ you only don't have a parameter to do that rather you have ios_base. Just wondering if there are owner,group and world settings that can be … | |
O_RWDR opens a file for read and write and pmode allows you to specify permission for each of the users? WHAT DOES IT MEAN BY WHAT PMODES AND O_RDWR ARE AVALABLE ON YOUR SYSTEM? CONSIDERING I AM USING VISTA I HAVE NO IDEA. I HAVE THE ABILITY TO READ AND … | |
show_int_vector method RETURNS MEMORY LOCATION FOR EVERTHING EXCEPT FOR LAST VALUE. main [code] #include "my_int_vector.h" #include <iostream> using namespace std; int main() { my_int_vector b(0); b.push_back(10); //b.show_int_vector(b); b.push_back(122); b.show_int_vector(b); //b.push_back(20000); return 0; } [/code] Interface [code] class my_int_vector { public: //constructor to create an array my_int_vector(int intial); //prints out the … | |
and how i would go about fixing it? main [code] #include <iostream> #include "Format.h" #include <fstream> using namespace std; int main() { Format format; //string word; char in; ifstream infile; bool a=true; bool b=true; bool c=true; while(b==true) { cout<<"to quit type 'q'\n" <<"enter 'c' to get from console\n" <<"enter 'f' … | |
Random numbers appear and i have no idea where they are appearing from. Problem is in << operator. Not sure how to fix it. Main #include <iostream> #include "Format.h" using namespace std; int main() { Format format; format.setJustification('l'); format.add_word("one"); format.add_word("two"); format.add_word("is"); cout<<format; return 0; } Implementation #include "Format.h" #include <vector> … | |
word is a private variable. MAin [code] #include <iostream> #include "FrameThePhrase.h" using namespace std; int main() { Frame_The_Phrase frame; char in; ifstream input; bool a=true; bool b=true; bool c=true; string length; while(b==true) { cout<<"to quit type 'q'\n" <<"enter 'c' to get from console\n" <<"enter 'f' to get from file\n"; cin>>in; … | |
Here is a link to the actual project. I could easily use getline for the phrase. Don't need to overload it to read in phrase. [url]http://home.earthlink.net/~craie/122/projects/framed.phrase.html[/url] | |
Please explain. Does it automatically include the default constructor? | |
I understand the concept but i don't know when to use and what my teacher expects when he says overload certain operators. | |
When you use getline(input,inputline) and you delete part of the inputline does it also ignore from the input file? | |
IT is defined in the back of my book but can't be found in my program. | |
ITS ALL THE WAY AT THE BOTTOM OF MY IMPLEMENTATION FILE. MAIN [code] #include <iostream> #include <fstream> #include "line_test.h" using namespace std; int main() { //open up file to be read string input; ifstream in; cout<<"enter file name which needs to be opened\n"; cin>>input; in.open(input.c_str()); while(!in) { in.close(); cout<<"the input … | |
why do i get undefined reference to error in my main with regards to isvalidname. It says undefined reference to... in my isvalidname i check if they enter in first name, char ws and then last name. Then i want to print out everything that i have deleted on that … |
The End.