pinsickle 17 Junior Poster in Training

I have a test in computer graphics and I was wondering if someone could confirm my understanding of the Scan-Line fill.

I just had a question of the special case of when an edge is a relative max or min. I know if that is the case the edge must either be shortened or counted twice. Do we do this to keep the required even number of edges for the line fill?

pinsickle 17 Junior Poster in Training

Python could be a good start for you. It has a different syntax and it is pretty fun to play with.

pinsickle 17 Junior Poster in Training

Look at setw(). It sets the width of text. A Google search will provide an explanation and examples.

pinsickle 17 Junior Poster in Training

The easiest way would not be not to store the password but a hash of the password. That way even if your packets are sniffed the person only sees garbage. When the user creates a password or logs in you can hash the password prior to sending it over the the network. The on the server side you can compare the send hash to the hash you have stored for the user in your database. Just Google hashing with salt to see examples.

iamthwee commented: Agrees +15
pinsickle 17 Junior Poster in Training

The method is overloaded to handle character arrays but not overloaded for any other array. http://download.oracle.com/javase/1.4.2/docs/api/java/io/PrintStream.html

jon.kiparsky commented: Yep. Good answer. +2
pinsickle 17 Junior Poster in Training

userRequest is local to getCommand, which means its memory disappears when control returns to main(). strtok() doesn't allocate new memory -- it just zero-terminates a token in the source string and returns a pointer to its first character. Therefore all the addresses in the parameters array are invalid when getCommand returns.

I would do something more like size_t getCommand(char *dest[], size_t size, char *source); so you can allocate the necessary memory in the caller and pass in a pointer to it. Implementation left as an exercise for the reader.

Thanks both of you for the help.

pinsickle 17 Junior Poster in Training

Maybe you can enlighten me as to how we(Daniweb) can diagnose a problem if the code is not complete.

Sorry if I offended you there. Main right now just has a for loop for printing

#define MAXARG 5

int main {
     char* parameters [MAXARG];
     int totalArg = 0;
     
     totalArg = getCommand (parameters);

     for (int i = 0; i < totalArg; i++){
           printf("%s\n", parameters[i]);
     }
}
pinsickle 17 Junior Poster in Training

You realize this is wrong

char* array [];

This is taken from your original posting.

I have a constant value that is inside of the brackets (just forgot to type it in the example) if that is what you are talking about, otherwise please enlighten me.

pinsickle 17 Junior Poster in Training

here is how I approached it. Like I said it shows up in the function but not in main:

int getCommand (char* cmdAndParameters[]){
	int argNum = 0;
	bool foundArg = true;
	char* delimiters = " \t\n";
	char userRequest[CMDLEN];
	
	fgets (userRequest,sizeof(userRequest), stdin); 

	if ((cmdAndParameters[argNum] = strtok(userRequest, delimiters)) != NULL){		
		argNum++;

		for (; argNum < MAXARG && foundArg; argNum++){
			if ((cmdAndParameters[argNum] = strtok(NULL,delimiters)) == NULL){
				foundArg = false;
			}
				 
		}	
		
	}

	return argNum;
}
pinsickle 17 Junior Poster in Training

I should remember this but I am rusty. I'm passing a char* [] to a function which will hold data that I have extracted using strtok. I've tested the output and it is doing what it is suppose to, at least it is inside of the function. As soon as I try to access the data inside of main I just get garbage. How do I pass the char* [] by reference? I thought that arrays were always passed by reference, well to be more specific that the pointer was copied but the array itself was by reference. I was trying something like this:

int main () {
     char* array [];
      function (array);     
}
void function (char* []){
     // fgets and other setup 
     array [0] = strtok (data, delimiters);
     // loop to max argument size or till out of arguments
         array[i] = strtok(NULL, delimiters);
}

Like I said I can check the array inside of the function and it is all there but I lose it when I get to main.

Thanks for the help

pinsickle 17 Junior Poster in Training

why do you write method two to accept integers and then pass it a float?

pinsickle 17 Junior Poster in Training

After removing 1 element from a list with 4 elements, how many elements are left?
Remember arrays are 0 based.

I get what is going on, now that I think about it my original question was kind of stupid to begin with. I mean what is an Arraylist... its a list with the referencing element numbers of an array. It should have been obvious if one removes an object from the list the elements would have to shift. Otherwise the nature of the linked list would be compromised, in other words you wouldn't be able to access any of the elements past the removed one.

pinsickle 17 Junior Poster in Training

Can you post your code?

import java.util.ArrayList;
public class test{
	
	public static void main (String args [])
	{
		ArrayList <String> bob = new ArrayList <String> ();
		bob.add ("1");
		bob.add ("2");
		bob.add ("3");
		bob.add ("4"); // right now is in element 3
		bob.remove(2); // this causes "4" to go to position 2 
		String taco = bob.get(3); // throws exception
		System.out.println(taco);
	}
}

however if you change bob.get(3) to bob.get(2) the output does become 4.

pinsickle 17 Junior Poster in Training

Are you sure it was the position of the new last or the old last element?

Post the code if you have further questions.

It was the old last. I set the list up to have 5 elements ( 0 - 4). I removed element 3 then tried to output element 4. That is when I got the out of bounds exception. I then tried the same process again but instead of outputting element 4, I tried element 3. It then spit out the value I formally had in element 4.

pinsickle 17 Junior Poster in Training

It does 'shrink' the list down. Well since it is a list it would probably be better to say that the pointers are rearranged. Anyway, I took an element out to the middle of the list and then tried to spit out the value of the last element of this list. This promptly threw an out of bounds exception.

pinsickle 17 Junior Poster in Training

yeah that was my original idea, but i forgot to grab my laptop before i headed to work. I'll test it when I get home and post the result unless someone else beats me to it.

pinsickle 17 Junior Poster in Training

In reguards to the remove function, what happens if you remove and item from the middle of this list? For example, say the list size was 5 (elements 0 - 4) and element 3 was removed. Would element 3 now contain a null value or would everything past element 3 get shifted to the left, or is it treated like a linked list and the refereance is just broken and redirected to element 4. Just curious, every example i've seen always removes from the end of the list.

Thanks

pinsickle 17 Junior Poster in Training

Wow thanks for the quick response. I didn't even think about the dll files. You were a huge help. The only issue I could run into is that I do my programming on a mac. Thankfully, I have an netbook that I could transfer my code to and make an exe file. Thanks again

pinsickle 17 Junior Poster in Training

Hello,

I was wondering how to make a c/c++ program installable on other computers. For example, lets say for some odd reason a friend wanted a hello world program. Obviously, if I complie the code it will only run on my computer. The may be a noobish question, but we still haven't learned about it in school and if we ask the professors, we get the "that is beyond the scope of this course" response. Thanks for the help.

pinsickle 17 Junior Poster in Training

I just have a quick question. I am working on a program for a friend of mine, more specifically a program that keeps track of stats of characters makes rolls etc. for DnD. Anyway, I am going to save the data using Serialization and keep the data together via a parent class ArrayList. Since I am going to make this a GUI based program with multiple windows running in tangent (one for each character), what would be a good approach to keeping track of and saving all of the separate data. I was thinking of something like making a global(and by that i mean a 'global class') ArrayList, so the entire program could use the same arraylist. Is there a better approach?

pinsickle 17 Junior Poster in Training

I recently starting learning Java, I have a pretty good grasp on C/C++ and wanted to expand my horizons. Anyway, I have being using the Headfirst Java book and recently finished the chapters on GUI. One thing that wasn't covered by the book was how to deal with child windows. I plan on using Java to make a time card system for my work place and anyone else that needs it (secondary question : When I finish my project could I post it on daniweb so others could download the source code to use/improve it?). So what I mean by child windows would be something like: The user would start on a name/password screen, after entering their information the login window would be replaced by a window that has the correct options for a user of his/her access level.
Any help on a class I need to research etc. would be appreciated. Thanks in advance.

pinsickle 17 Junior Poster in Training

By the way I had this problem when using my mac (I say this because every similar problem I found was always on a mac) Anyway, turns out I need to use Thread.sleep (5000) with the 5000 representing miliseconds to give the player time finish its thing.

// something like this
player.start ();
Thread.sleep (5000);
player.close ();
pinsickle 17 Junior Poster in Training

Hello,

I am pretty new to Java so I am following along in a book to learn it. I am currently in the beginnings of making a MIDI player but I have run into to a problem. I am using a sequencer, if I don't close the sequencer the program will run the midi sound but will not exit. However if I do close the sequencer the program completes but will not play the sound. Any help would be appreciated.

import javax.sound.midi.*;

public class MiniMusicCmdLine
{
    public static void main (String [] args)
    {
        MiniMusicCmdLine mini = new MiniMusicCmdLine ();
        if (args.length < 2)
        {
            System.out.println ("Two arguements dude!!!");
        }
        else
        {
            int instrument = Integer.parseInt (args[0]);
            int note = Integer.parseInt (args[1]);
            mini.play (instrument, note);
        }
    }
    
    public void play (int instrument, int note)
    {
        try
        {
            Sequencer player = MidiSystem.getSequencer ();
            player.open ();
            Sequence seq = new Sequence (Sequence.PPQ, 4);
            Track track = seq.createTrack ();
            
            ShortMessage first = new ShortMessage ();
            first.setMessage (192,1, instrument, 0);
            MidiEvent changeInstrument = new MidiEvent (first, 1);
            track.add (changeInstrument);
            
            ShortMessage a = new ShortMessage ();
            a.setMessage (144, 1, note, 100);
            MidiEvent noteOn = new MidiEvent (a, 1);
            track.add (noteOn);
            
            ShortMessage b = new ShortMessage ();
            b.setMessage (128, 1, note, 100);
            MidiEvent noteOff = new MidiEvent (b, 16);
            track.add (noteOff);
            player.setSequence (seq);
            player.start ();
        }
        catch (Exception ex)
        {
            ex.printStackTrace ();
        }
    }
}
pinsickle 17 Junior Poster in Training

My program has to open a text file. I want it to give an error message if the file does not exist (or has a diferent name, which is the same, really).

I'm using a pretty old Borland compiler, because home assingnments are checked with it.

Compiler shows me this error:
Info :Compiling L:\algorithms\test.cpp
Error: test.cpp(6,22):'is_open' is not a member of 'ifstream'

#include <iostream>
#include <fstream>

int main () {
  ifstream myfile ("data.txt");
  if (myfile.is_open())
  {
    myfile << "This is a line.\n";
    myfile << "This is another line.\n";
    myfile.close();
  }
  else cout << "Unable to open file";
  return 0;
}

I have always done something like this

if (!myfile)
{
  // error message
// exit (1)
}
// do file stuff here
pinsickle 17 Junior Poster in Training

B tress are pretty common. You might want to check out suffix trees as well.

Thanks I will check suffix tree out

pinsickle 17 Junior Poster in Training

I am about to start work on a side project during summer break. Part of the project will require the storage of user's information on a hardrive. I have been exposed to b-trees so I know that is one option for dealing with the data, but what are some other data structures designed with seconday storage in mind? I trying google searches but I'm not reallying pulling up anything useful.

pinsickle 17 Junior Poster in Training

I remember Dijkstra’s Algorithm from my layout class. Good times. I think I would change the architecture so that you use a linked list to store connections between nodes. A less elegant approach might be to store a list of connections in an array. When the connection has been checked, the linked list node would be removed, or the array element would be set to zero. In either case, I would not worry about which intermediate distance is the shortest until a full path has been found. For example, if you find one path that is 3 + 5+ 4 + 10, and you check one path that has 30 as the first distance, you would immediately stop checking that path, and would delete that linked list head, or set the array to zero. Good luck.

I would love to do that it seems much more natural to do it that way. However, that isn't how our professor wants us to do it.
I have figure out that my problem isn't jumping to the next shortest vertex. It does that, I just cant figure out how to get it to jump back if the vertex points to nowhere.

pinsickle 17 Junior Poster in Training

I'm trying to learn Java, pretty easy so far as my previous experiance is with C/C++. I was just curious how to call java classes from different files. That way I don't have to have main as well as all of my classes crammed into one file. I'm sure the book that I am working out of will eventually tackle this issue. However, it is driving me crazy (can't stand my code to look crammed together and cluttered.) Thanks for the help.

Kind of worded that funny.

For example in C/C++ you could do #include "fileName I want to refer to"
I'm just asking for the java equivalent.

pinsickle 17 Junior Poster in Training
void Graph::writeShortestPaths (int first, ostream& outfile)
{
    for (int i = 0; i < n; i++)// each vertex
    {
        currentDistances[i] = 999999;
        predecessors[i] = -1;
        toBeChecked[i] = true;
    }

    currentDistances[first] = 0;
    writeShortestPathsHeader (outfile, first);
    int pass = 0;
    while (moreShortestPathsToFind()) // see below
    { 
        int minVertex = first; // index of closest of vertices remaining to be reached
        toBeChecked[minVertex] = false;
        for (int i = 0; i < n; i++)// each vertex i
        {
            if (distances[n * minVertex + i] != 999 && predecessors[i] == -1) // i hasn't been reached yet and it is reachable from the new minVertex
            {
                if (currentDistances[i] > distances[n * minVertex + i])// previous distance to i is larger than the distance via minVertex
                {
                    currentDistances[i] = distances[n * minVertex + i];// distance via minVertex
                    predecessors[i] = minVertex;
                    toBeChecked[minVertex] = false;
                    // cant figure out how to set First!!!! At least not without out getttng a never ending while loop
                }
            }
        }
        writeShortestPathsIntermediate (outfile, pass, minVertex);
    }
    writeShortestPathsResults (outfile);
}

I'm getting frustrated, I can do this algorithm on paper. However, I cant get it to work in code. I can't seem to figure out how to jump the the next vertex with the shortest distance. Thanks for any help.

pinsickle 17 Junior Poster in Training

you are calling reverse inside of the for loop, you only need the array to be reversed once so call it outside of the for loop

pinsickle 17 Junior Poster in Training

google search ifstream cplusplus.com will tell you all about it with example code. Also put you code in code tags, no a huge deal for that small bit of code but can make it harder to read.

pinsickle 17 Junior Poster in Training

Maybe I was being vague, I meant I was trying to do something like saving 100 as a char would in turn be translated to 'd'. But it turns out my idea works I was just being goofy and forgot to place a check to keep it from trying to print a non printable character.

pinsickle 17 Junior Poster in Training

Hello,

I'm working on a problem (Huffman Tree encoding/decoding) and I need to covert and Int to a char.

I was trying to use

char temp = static_cast <char> (index);  //index is an integer

it compiles but if I try to print, it crashes so obviously that idea doesn't work (or at least I am doing it wrong lol)

I know about the itoa function but we are not allowed to use it as it will not work with cygwin.

Thanks

pinsickle 17 Junior Poster in Training

Basicly a Binary Tree but on a file so to try and make of for the slowness of checking data off of a file you store nodes in blocks.

pinsickle 17 Junior Poster in Training

here is a start on you what to do:

1. Look up random access files for the function to get the word from the file (you be using seekp or seek g I can't remember)

2. as far as the stars part goes, You could setup a char array and fill it with stars. Then when the user guesses compare his/her guess to the original array if they match replace that element of the starts array with the guessed letter. (probably a better way but i'm just a quick idea to get you going.)

pinsickle 17 Junior Poster in Training

You might wanna post your solution for others that stumbles upon this thread next week, maybe next month maybe in a few years! :)

At least i hate googling and then being cheered up by finding a post exactly regarding my problem, and the solution is: "I found the solution".

BTreeNode* newRoot = 0;
		while (current -> isNotLeaf())// current node is not a leaf
		{	
			current = current->findChild (newKey);
		}
			newRoot = current->addKey (newKey);
		
		if (newRoot != 0)// split occurred at topmost level
		{
			root = newRoot;
		}
	} // end else root != 0

Like I said I was overcomplicating it, lol

pinsickle 17 Junior Poster in Training

I've noticed every time someone claims they have an easy or quick question, you can count on a minimum of a week or two of struggle to get the problem figured out.

If it was so easy, why do you have to ask? :icon_wink:

Lol true, I actually it figured out last night (was trying to make it too idea complicated). Just finished debugging it and it seems to work.

pinsickle 17 Junior Poster in Training

Probably a dumb question but, How can you tell if a "split" has occurred all the way up a btree? Would it be that the parent pointer would be NULL? Like I said probably a dumb question. I've got my BTreeNode class working (including the add) but the BTree class I have is not resetting the root

void BTree::add (int newKey)
{
	if (root == 0)
	{
		root = new BTreeNode (0, newKey, 0);
	}
	else // root != 0
	{
		BTreeNode* current = root;
		BTreeNode* newRoot = 0;
		while (current -> isNotLeaf())// current node is not a leaf
		{	
			current = current->findChild (newKey);
			newRoot = current->addKey (newKey);
		}
		if (current -> getChild (5) == 0)// split occurred at topmost level (getChild(5) is the parent pointer location
		{
			root = newRoot;
		}
	} // end else root != 0
}
pinsickle 17 Junior Poster in Training

Perhaps you should consult your professor?

That is the problem, if brought up in class he basically says that we don't have time to discuss it as we are behind and to email him. Virtually everyone in class has talked and/or emailed him to no avail.

Here is what I have so far :

class BTreeNode : public LinkedNode
{
	public:
		BTreeNode
			(BTreeNode* child0, int key0, BTreeNode* child1);
		
		BTreeNode
			(const BTreeNode& sibling);

		bool isNotLeaf
			(void) const;

		BTreeNode* findChild
			(int newKey) const;

		BTreeNode* addKey
			(int newKey, BTreeNode* newChild = 0);

		BTreeNode* getChild
			(int i) const;

		void write
			(ostream& outfile) const;
			
		int getKey (int number = 0) const;

	private:
		void setChild
			(int i, BTreeNode* child);

		BTreeNode* getParent
			(void) const;

		void setParent
			(BTreeNode* newParent);

	private:
		int keyCount;
		int keys [5]; // 5th used for split
};

ostream& operator << (ostream& outfile, const BTreeNode& node);
BTreeNode::BTreeNode (BTreeNode* child0, int key0, BTreeNode* child1): LinkedNode (7)
{
	setParent(0);
	keyCount = 1;
	keys[0] = key0;
 	setChild (1, child0);// 0 for original root
	setChild (2, child1);
	
	for (int i = 1; i <= 3; i++) // is this loop necessary?
	{
		keys [i] = 999999; // key i = +INFINITY;
		setChild (i+1, 0); // child i+1 = 0;
	}

	for (int i = 0; i <= 1; i++)
	{
		if  (getChild(i) != 0) // true for new roots
		{
			getChild(i) -> setParent (this);
		}
	}
}

BTreeNode::BTreeNode (const BTreeNode& sibling): LinkedNode (7)
{
	setParent (sibling.getParent());
	keyCount = 2;
	keys[0] = sibling.getKey (3);
	keys[1] = sibling.getKey …
pinsickle 17 Junior Poster in Training
class BTreeNode : public LinkedNode
{
	public:
		BTreeNode
			(BTreeNode* child0, int key0, BTreeNode* child1);
		
		BTreeNode
			(const BTreeNode& sibling);

		bool isNotLeaf
			(void) const;

		BTreeNode* findChild
			(int newKey) const;

		BTreeNode* addKey
			(int newKey, BTreeNode* newChild = 0);

		BTreeNode* getChild
			(int i) const;

		void write
			(ostream& outfile) const;

	private:
		void setChild
			(int i, BTreeNode* child);

		BTreeNode* getParent
			(void) const;

		void setParent
			(BTreeNode* newParent);

	private:
		int keyCount;
		int keys [5]; // 5th used for split
};

ostream& operator << (ostream& outfile, const BTreeNode& node);
BTreeNode::BTreeNode (BTreeNode* child0, int key0, BTreeNode* child1)
{
	parent = 0;
	keyCount = 1;
	keys[0] = key0;
	children[0] = child0; // 0 for original root
	children[1] = child1; // 0 for original root
	for (int i = 1; i <= 3; i++) // is this loop necessary?
	{
		// key i = +INFINITY;
		// child i+1 = 0;
	}

	for (i = 0; i <= 1; i++)
	{
		if // (child i != 0) // true for new roots
			// child i's parent = this;
	}
}

My professor has me confused with this constructor. Is children [] and parent suppose to be part of the keys array or is it private data for BTreeNode that he forgot to include in the .h file??

Thanks for the help.

pinsickle 17 Junior Poster in Training

Well I plan on having a GUI interface, probably using QT possibly Java.
I'd love to have a console interface as it would make the project (a employee time card program) much easier. That way I could just concentrate on the networking and encryption part of it.

pinsickle 17 Junior Poster in Training

Does anyone know where I can find info on setting up dll files to be called by a program? I am about to start a project but I realized it would be helpful if the finished program could be ran without a compiler on every computer it is to be ran on.

pinsickle 17 Junior Poster in Training

I am planning on starting a project during summer break. I am going to create a employee clock in system for my work place (and anywhere else that wants it.) I figured it'd be good to get some practical experience before I graduate. The actual structure of the program I am fine on, however, I have no experience with networking (going to store the clock in data on a sever) and little experience with data encryption. Does anyone have any good books or websites to suggest. I plan on doing it with QT on my mac so any windows exclusive networking/encryption will not help me. I want to make the code as non-OS specific as possible. I plan on giving the program to whoever wants it, so I want to avoid redoing code for a linux/windows/mac user.

pinsickle 17 Junior Poster in Training

I have a weird file i/o or system() error. Here is the deal, I completed an assignment for threaded trees recently. My professor wanted us to turn in own data set we used to test our tree along with the one he provided for us.
I thought I'd be fancy and set it up so when the program was ran the user could choose between the default (professors') data or mine. If my data set was chosen then I would use system () to call another program I wrote that would 'randomize' the data in my tree test file.

When my data is chosen and the 'randomize' function is ran it does what it is suppose to but I always get an extra node in my tree (usually its the path name to where my files are located). Thought it was weird. I wasn't sure if it would be a file i/o error or something to do with me using system.

Here is the code in question but be forewarned it's not my best work (was just interested in seeing how system() worked)

/***************************************
 * swap.cpp is used to randomize       *
 * the data upon request               *
 * the swap.exe is intended to be ran  *
 * inside of ds09.exe.                 *
 **************************************/

#include "master.h"
int DATA_SIZE = 7;

int main() {
struct data {
    char name[30]; // holds customer's name
    char number[12]; // holds customer's phone number
    bool written;    // used to tell if data has …
pinsickle 17 Junior Poster in Training

>>void writeIteratively (ostream& outfile)

That function does not have a this pointer because its not a member of a c++ class. Maybe you meant void BinarySearchTree::writeIteratively(...);

Sigh...... dumb mistake, I should have caught that. Thanks for your help

pinsickle 17 Junior Poster in Training
class BinarySearchTree
{
   public:
      BinarySearchTree
         (void);

      bool addRecursively // calls addRecursive (see private)
         (BinarySearchTreeNode* newAdd);
      
      bool addIteratively
         (BinarySearchTreeNode* newAdd);

      void writeRecursively // calls writeRecursive (see private)
            (ostream& outfile) const;
            
      void writeIteratively // if implemented, requires a stack -
         (ostream& outfile) const; // - see oop06

   private:
      void addRecursively
            (BinarySearchTreeNode* currentRoot,
                  BinarySearchTreeNode* newAdd);

      void writeRecursively
            (ostream& outfile,
               BinarySearchTreeNode* currentRoot) const;

   protected:
      BinarySearchTreeNode* getRoot // provided for descendant classes
               (void) const;

   private:
      BinarySearchTreeNode* root;
};
void writeIteratively (ostream& outfile) 
{
    ThreadedTreeNode* current =  this -> BinarySearchTree::getRoot();// start current at root
    ThreadedTreeNode* previous = 0;
.......

Maybe I am missing the obvious but I can not seem to get the root from the inherited binary search tree. I know my professor is wanting me to use the protected method he provided but when I try to use it with this -> or (*this).getRoot.
I get the error i get the invalid use of this in non member function error. Obviously since root (binary search tree) is private I cannot call it directly. Any help would be appreciated.

pinsickle 17 Junior Poster in Training
class Array
{
    public:
        Array
            (int newSize, int order);
        Array
            (const Array& original);
        ~Array
            (void);
        void write
            (ostream& outfile, char* sortName, char* orderName);
        
        int getSize (void);

        void insertionSort (void);
        
        void selectionSort (void);

        void bubbleSort (void);
        
        static void initShellH (void);
        
        void shellSort (void);
        
        void heapSort (void);
        
        void quickSort (void);
        
        void mergeSort (void);
        
        void radixSort (void);
        
    private:
        void swap
            (int& a, int& b);
            
        void moveHeapDown (int first, int last);
        
        void quickSort (int first, int last);
        
        void mergeSort (int first, int last);
        
        void merge (int first, int last);
        
        void addToTemp(int*& assigned, int assignTo);
        
        int* data;
        int size;
	static int shellH [22];

};
void Array::initShellH (void)
    {
        int numSkip = 1;// smallest shell increment is one
        
        for (int i = 0; i < 22; i++)
        {
            shellH[i] = numSkip;
            numSkip = numSkip * 3 + 1;// suggested subsequent increments are 3*previous + 1          
        }
        return;
    } // end method

when I call shellH[] in my method it doesn't recognize it (missing symbols error). Do I need to move the shellH declaration to my .cpp file, or am I just doing something else wrong?

pinsickle 17 Junior Poster in Training

wait i'm thinking dumb i thought you had the r_number as a string.
change the strcmp(.....) part to

while (j < num && enteredNum != car1[j].r_number)
pinsickle 17 Junior Poster in Training

do something like

int j = 0
while (j < num && strcmp(enteredNum, car1[j].r_number) !=0)
{
j++
}

if (j < num)
{
  cout << car1[j].milage << car1.[j].(whatever other data);
}
else 
{
  cout << "car not found\n"
}

of course that is a lot to cram in a switch statement so you may want to make the above into a function
also the enteredNum i am referencing is what ever variable the number the user enters to search. I would suggest accepting their data as a string, that way you can use strcmp

pinsickle 17 Junior Poster in Training

ok thank you so much dude.

no problem, unless you have any other questions make sure to mark this thread as solved. That way everyone will know to skip over this tread and help someone else.