jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That's mybad for not taking enough notice of it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Do you initialize count before you try to access that element at EmployeeList[count]? Also, since you seemingly haven't added the first element until after you try to access it, there will be nothing in the container. What you should really do is move the Add() before you try to access the employeeList[] member.
As it is, rather than trying to create your own count variable, you can get employeeList.Count which is a field that will tell you how many objects are in the container (so you'd need to have access the last member as employeeList[employeeList.Count - 1]).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need a for loop over all of the rows, a for loop for each row (with an if statement to switch from printing spaces to printing stars (so at column a and column b I need a star, the rest I need spaces)). It sounded like you had a lot of it, just put some " " spaces in where appropriate.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

ok. i made some skitts, and i must say that i still stuked.
the code, now mine :)

This is debatable, but you have put in some effort on your own.

so the qestions is;
1 - how can i return the base menu after i set new employe? i tried the do while loop, but probably i wrote it not correct.

I would put a 5th number in your menu for quit and then have the condition in your do/while be (chois1 !=5). If you're stuck with 4 choices, quit after the printout using a similar (chois1 !=4).

2 - how can i count the employes for later use such as delete, update, print? i used array but i dont know how actualy get to every one of employes for check his data and manipulate this data.

You can make a static variable in your class (which is sort of what you were trying to do but it wasn't declared properly). This is probably not the best way to do it. I would use the List container to hold each new object:
List <employe> employeeList = new List<employe>();
employeeList.Add(new employe( constructor arguments));
then use employeeList[0].setSecretary(method arguments); (and for 1,2,3,4....) or you could make a new employee, set it all up and then add it to the list.
That way you have a count of your employees

3 - why i have some error issues while i run the program? error list is empty...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I can't find anything wrong with it.

Never mind the fact that it doesn't compile, you have the syntax for printf and scanf completely wrong, and least of all it's some C/C++ hybrid program...

For better or worse, the compiler is usually right.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Take out a piece of paper and write out 2^2 in terms of 2, then 2^3 in terms of two, and to the fourth in terms of two until you see the pattern. Break the product 2 ^ n down into n steps, take what happens at each step and do that in a loop. It's a repeated calculation that's why it's an ideal problem for a computer. Then generalize this to all numbers to all powers (within reason).

Try some code and post back with what you've got.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think you understand my questioning your motives when you say (essentially) "this isn't mine but help me change things here and there just enough and turn this into a form which I can turn it in for a grade." Unfair to yourself and your classmates.

Now, we can start this over. You should post further details about your assignment along with an attempt at the employee class. Make a new Console application if you haven't already.

As a hint, you should probably separate your class into its own file. To do this, go to the Solution Explorer on the right side of the IDE (if you can't see it go to View/Solution Explorer). Right click on your project name (in bold). Select Add then select Class... name it and a file will show up in your project.

Also make a separate file for your derived class, the same way you did above except name it for your derived class.

Now layout the class in a skeleton with the methods unfinished and post back with any questions.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

this code is not mine, and i need to write somethink like this but not exactly this way.

That doesn't sound the least bit like you want us to help you cheat.

There's one good way to do what you want to accomplish, try it yourself and come back with questions about your code.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Just find the amound of hertz.

Not entirely true.
"CPU instruction rates are different to clock frequencies, usually reported in Hz, as each instruction may require several clock cycles to complete or may be capable of executing multiple independent instructions at once. Additionally, the number of cycles required for instructions to complete is dependent upon the instruction being executed."
-http://en.wikipedia.org/wiki/Million_instructions_per_second#Million_instructions_per_second

EDIT: Fbody beat me to it with a better explanation! :)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I was being facetious more than anything about the 0.25, I know it's important. However, with your calculations you were losing 5 days per year.

cwarn23 commented: Thanks for pointing out the error... +0
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Last I checked on the calendar a year had 365 days (+0.25 fudge factor)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

$year=floor($time/([B][I][U]360.25[/U][/I][/B]*24*60*60)); If you're going to be Captain Smartguy, you ought to have your numbers correct at the very least.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Hint: use your inner loop to control the spaces.

(also please do yourself a favor and read http://www.eskimo.com/~scs/readings/voidmain.960823.html ) about void main. main() should return an int. Make it a New Year's resolution)

(and of course code tags...)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I may be missing something but in the inorder method, you have an if statement. Either path that you take calls the function recursively and there doesn't appear to be a stopping condition.

One thing I noticed too on lines 29 and 159 you are trying to assign the value NULL to a char. The compiler complained about that one. You had redefined NULL but you didn't have to it's in <iostream> and a bunch of others.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm not 100% sure. I honestly don't have the experience with this kind of thing. That article seems to cover what to do with typedefs but in the context of a struct. People that know more about this kind of thing will probably pick up on the thread. I just didn't want you to think you had to scrap and translate everything. I wish I could be more help.

sknake commented: good advice +6
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

There's no need to translate anything in terms of the DLL. See this link: http://msdn.microsoft.com/en-us/library/aa288468(VS.71).aspx What do the header files contain? With the dll import you will be specifying your function prototypes right in the C# code. Any #defines can be translated into consts (or into methods if they define macros).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

This is a better way to have it:
Player.h

#ifndef PLAYER_H
#define PLAYER_H

#include <iostream>
#include <string>
using std::string;
class Player
{
	string name;
	int score;

	public:
		Player();
		Player(string name);
		string Get_name();
		void Set_name(string name); 
		void Input_name();
};
#endif

Player.cpp

#include "player.h"
using std::cout;
using std::cin;

Player::Player()
{
	name = "Default";
	score = 0;
}

Player::Player(string name)
{
	this->name = name;
}

string Player::Get_name()
{
	return name;
}

void Player::Set_name(string name)
{
	this->name = name;
}

void Player::Input_name()
{
	cout <<"Enter a name: ";
	cin >> name;
}

playermain.cpp

#include "player.h"
using std::cout;
using std::endl;
int main()
{
	Player player1,player2("Bob");
	player1.Input_name();
	cout <<player1.Get_name()<<endl;
	cout <<player2.Get_name()<<endl;
	
}

Let your getters and setters be just that, a way to get or set your private member variables. Make a header for your class declarations, make a cpp file for your class method definitions, make a cpp for main() and include your header file in both of the cpp files. It's generally not necessary to include a cpp file in another. If you are compiling at the command line, compile Player.cpp then Playermain.cpp or include them in the same project in your IDE.

NB: Normally I would let you get most of this by yourself but the other poster kinda steered you in the wrong direction a bit so I figured having an example would get you back on track.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Is there some reason why they would show up now and not any other time? (I'm just personally curious I know you've got many more things on your plate besides our post counts lol)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Similar to what I reported in http://www.daniweb.com/forums/thread249581.html (there's a disparity in my solved threads too). If it's the same situation, it has to do with the mysterious "reported posts" forum which is visible to moderators. I'm not sure how we would get credit for threads solved there as we would be considered the OP of the bad post report.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think this is what you are looking for. I didn't test it with an application though.
tbMessage is a rich text box and btnSend in this (pretend) example would send the text to the other conversant. SendMessage was added in just so the button would have an action.

private void tbMessage_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter && tbMessage.Focused)
                btnSend.PerformClick();
        }

private void btnSend_Click(object sender, EventArgs e)
        {
            SendMessage(tbMessage.Text);
        }
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What do you have so far (for the code)? Hint: You'll need to use "for."

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

He's talking about the line numbers in your second program. Whichever one you are working with, get rid of all but one srand() call, which should be situated anywhere before the first call to rand() -- but preferably at the top of the program.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Evidently you can get the number of clicks through a mousemove event (accessing them as e.Delta).
see http://www.pcreview.co.uk/forums/thread-1313418.php

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Each time that you report a post, a thread gets created in a hidden moderator forum, and your post count goes up by one, even though it's a post you can't see.

Right, I had read about that phenomenon with niek_e's old thread. What was strange about it was that the change happened so suddenly and that there was a disparity between the profile total count and the one on the upper right corner of the posts. It's no skin off my nose, I suppose I'll take the extra posts, but I just wanted to make sure it wasn't something going wrong. ;)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

My post total just jumped by about 50 since last time I checked this morning.

EDIT: It only shows that in the profile. On my posts themselves it says the right amount.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

google "C++ pointers references" and variants thereof

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm surprised it didn't give you grief for pow, as there is no definition that takes 2 ints (http://www.cplusplus.com/reference/clibrary/cmath/pow/)

Look into fmod (http://www.cplusplus.com/reference/clibrary/cmath/fmod/) which is like % but for floats/doubles/etc.

Also, you should include <cmath> instead of math.h and main() should return an int.

I ran the program but I did not check your logic completely. I think you are off by one exponent. Rather than go through all this exponentiation you should look into the >> and << (shift operators for bits, not the operator for iostream).

EDIT: Do a quick search around the site. There are a ton of examples. Most of them take in the binary as a string (which I was going to suggest) and then do the bitshifting.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes. What do you have so far? Please read http://www.daniweb.com/forums/announcement8-2.html

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So what do you have so far? Even if you haven't covered this exact assignment I'm sure you have all the tools with which to tackle it.

Can you write a menu with those selections and call an appropriate function for each (even if it's just a skeleton for a function for the time being)?

Also please read the following: http://www.daniweb.com/forums/announcement8-2.html

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I figured I would go ahead and introduced myself now. <snip> After being a member for a few months I have decided to stay.

I realize this is the resurrected part of the thread but it made me feel better since I had been (and still am lol) holding out to post in C.I.

Just saying hello to myself/testing

If this persists you might want to get it checked into LOL. It is inspiring your ASCII art career, though (see his post from 12/25 in C# if you don't believe me).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You're very welcome :) Look forward to strings so you can avoid much of this "stuff."

I should probably put this in my own post (slaps my own wrists with a ruler), but does anyone out there in TV Land know the way to handle the while ((c = getchar()) != EOF) construct (where c is an int) without the special provisions? With the OPs code I always had to hit enter, put in the ^Z and hit enter again. I did search the net high and low but got mainly the information about getchar() returning an int, EOF being negative, etc.

For my penance I will dust off my copy of Kelley/Pohl from the 90's.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Line 29 should be chcount[lcv]++; instead of chcount[lcv] = chcount[lcv]++; which can cause weird results.

Ive gotten it so it works after hitting enter then EOF but it counts the enter as a character.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Part of the problem is you want lcv == CHARCOUNT on line 36 -- you've traversed the entire array to the end and the character isn't there. Ignore what I said in my other edit about EOF, but make sure your user knows to hit EOF (ctrl-Z or F6) at the end of the input.

(sorry about all the edits, I had a train of thought but got derailed -- I thought I knew exactly what was wrong with it right off the bat but it needed a closer study)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

the first thing to do is search 4 sum books online.. or search 4 sum stuff related to C++, u'll surely get to know

Exactly. I know that took a lot out of you.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

For C++ QT is a decent library and it is somewhat portable (it's distributed by Nokia now). There's a free pdf of a decent book(released by the author under Open Publication) at http://www.qtrac.eu/marksummerfield.html (the author's website).
He steps you through (and they are nice manageable steps) making a very small scale spreadsheet program.

There are lots of other options, like wxWidgets (I've never used but a lot of people like). Of course there's the whole gamut of Windows GUI tools -- Win32API (not the best place to start if you haven't done it before), MFC (which is C++ based), .NET (but you need managed C++ and this is a whole different animal).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Oye, I just looked it up, and I am wrong again..boy have I been on a role lately...sorry for the wrong info

Nah, it happens, not to worry. Worst case he/she'll come up with some amazing art (speaking of which check out sknake's post from 12/25 (http://www.daniweb.com/forums/thread248920.html) -- it's in C#, but it could be easily translated).

In terms of ASCII, I think people raised on BASIC probably still dream of CHR$ -- EDIT: oops just looked it up and it still exists in VB.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Sorry restrictment, because that is "ASCII art" he's talking about, making shapes/pictures out of ASCII characters.

ASCII is the American Standard Code for Information Interchange. Contrast it with a slightly older standard like EBCDIC (which I think still exists on some mainframes). From my understanding of it, if your system supports ASCII (see this table) lowercase a, for example, must be represented by 97 (as do all the other letter, symbols,and things (like "beep")).

UNICODE is a newer (late 80's early 90's) which encompasses a much larger set, including many of the international alphabets, but still has a subset for the original ASCII codes (entitled UTF-8).

Well, that's probably way more than you wanted to know but in a nutshell it's just the numbers used to represent characters and a standard for saying how that conversion should be laid out. This wasn't mean to be exhaustive but more to give you the links in case you wanted to know anything else.

tux4life commented: Excellent post :) +6
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I tried to call Init() in MyControl's constructor as you suggested, but it is not good enough because InitializeComponent() of the form is generated like this:

Apologies for leading you down the wrong path. I guess I'm not able to appreciate the dependencies of your code.

in my real application MyControl inherits from Panel rather than UserControl

I'm not sure I understand, so this is just a model of your code? If so you should put up the relevant sections of what you are actually working on. Otherwise we're chasing 2 different targets ;)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You're unfortunately about 2 days too late for presents.

Please take a look at this http://www.daniweb.com/forums/announcement61-2.html . On the bright side it sounds like it could be kind of a neat project!

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You've come pretty far with the first part, why don't you see what you can come up with. You were right, you probably want to read the number into a char array. Like you said you probably want to use a switch block to match Roman numeral to regular number. You might put that into a function. Take an example, like MCMXLVIII which has a few of the complications we talked about and write that as a "worst case." Go through your idea step by step on a piece of paper. Code it. Then after you've got that down test it with some of the simpler cases to see if you've overgeneralized it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

One thing to consider:

else
{
	node*temp=top;

 } //where is temp at this point?  nowhere it's been destroyed

Small(er) stuff:
It should be #include <iostream> and #include <string> (the latter of which you don't really use in your program).
You need using namespace std; (or better yet using std::cout; using std::endl; , or qualify them with std:: in the body of your code).
Change data to char in your struct, have main returning an int (and then return one) and look into cin.get() (see here for a reference).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Look for numbers out of their size order. You could use a switch statment for the conversion and then add or subtract as needed. For example MCM: C is less than M could be 1100, but look ahead to the next one M, ok so we know it's going to be 1000 + (1000-100) we know that we were 100 before 1000 so there isn't going to be any 500 (since adding a D would just make it 2400 or MMCD). Count the hundreds and subtract for any XC type situations.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

words[m] is just one char

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Hehe. No worries. You're doing pretty darn good for your second day!

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

//first line of the file OL001 bob red 13
myfile>>s1.name; //OL001 so far so good but this is the ID
myfile>>s1.color; //bob still "ok" at least matches in type
myfile>>s1.age; //red not good, what is the number red?
myfile>>s1.id; // 13 okay matches but red already corrupted this

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Clear clears the failbit (a flag (bit) that was set to true when your used typed in a letter for your id instead of a number). cin.fail() is what checks the bits to see if the failbit has been set and returns true if it was. At that time that it fails, the stream is no longer valid to take more input. Clear allows you to reset this failed state and once again take input into your stream.
http://www.cplusplus.com/reference/iostream/ios/clear/

Ignore in that case discards up to 1000 characters or until it reaches a newline (whichever comes first).
http://www.cplusplus.com/reference/iostream/istream/ignore/

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Ok. I would take string id out of the global scope and just declare it locally in the body of the function. Also, it should be an int since that's what s1.id is. If you really need it elsewhere in the program, declare it in main and pass it in by reference to the function.

You have a mismatch between inData and myfile. There should only be one name for the infile stream used in this case.

Finally, you can substitute cin.get(); for system("pause");for a more portable solution (see this). EDIT: also, substituting using std::cout; using std::endl; etc for using namespace std; keeps your namespace less polluted.

EDIT II: You need to rearrange your input sequence to match your file and take care of the OLs (do you want them or not?).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Where does words[] come into play? I see you declare it at the beginning and you try to display it at the end but it's no where in the middle...

Also, why is name 20 chars and temp 10 chars? What happens if you try to copy a long name into temp?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You can try it with the -> but let me see what the whole thing looks like.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I've seen stuff with people putting a bar over it for multiple thousands, so V (bar) = 5000.
With your example of 595, how many thousands are in it? none, remainder 595, how many 500s are in it, 1, remainder 95. So we have D. Here's where it's a little tricky, but seems they only put the C if it's 100 before 1000, so 950 is not LM, it's CML (50 above 100 before 1000). So for numbers less than 100 we put if it's 10 less and put the remainder on the other side. 95 is between 90 and 100 with a remainder of 5. So we get XCV.

So subtraction and modulus (%) are your friends along with making some if statements for the trickier exceptions.