jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You probably don't need an array of strings. Just make a function that takes two strings as parameters. void isPalindrome(char * str1,char * str2) { } Use the length of one to step backwards through that string while doing forwards through the other one.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

free(y); ?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

use getDay()

He's already accomplishing that with the "day" that's in the cout statement. He's trying to print the name of the object with the DayOfTheWeek.getDay, which isn't giving him what he needs, so I was saying he should just eliminate the first part outright.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Just display the value, I don't think that anyone is expecting you to display the object's name (I suppose you could make a map, as someone will probably suggest, but that may be beyond what your instructor is expecting you to know at this point).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

There's no readily available way to get the name of an object from within the program, unfortunately.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So why do you need that DayOfTheWeek.getDay portion at all then? (it's not doing anything anyway) Just output the day with that cout.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What are you trying to print out with "DayOfTheWeek.getDay"? That call would only work if getDay were a static member variable of DayOfTheWeek.

Which line is the compiler referring to with the second error message?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Whew, it took me a while, but I think I've got it. Your turn.

(at least post what you have so far so someone can help you with your code)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I don't think I can say anything "constructive" here, but just imagine what I could have said. And thank you, I know.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

isn't it that I should do something like this:

string s[200]

? I have knowledge with Arrays also its just that I did this program before Arrays and functions were discussed to us and so I'm going back to this program trying to apply my knowledge from the recently discussed topics.

You can even use a single character array (as you don't need 200 different strings, you can have one character for each seat ):

char seats[5]; //let's use 5 for demonstration purposes, but yours would be 200 long
|  |  |  |  |  |   There are 5 seats available
|X |  |X |  |  |   Seats 0 and 2 (1st and 3rd) are taken
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

First see how much you can get rid of with arrays and loops, as arkoenig and I said before. That's the majority of it. You can package some of your menus and maybe the seat selection into a function.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I would learn to use arrays first, then functions. You can consolidate all of your tickets down to an array of characters (or eventually a std::string when you learn more about those).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

LOL because you wanted an array of strings.

std::string strarr[2];
strarr[0] = "hello"; //first string of the array
strarr[1] = "world"; //second string of the array
strarr[0][0] is 'h'
strarr[1][0] is 'w'
strarr[0][4] is 'o'

Just like if

std::string str1 = "hello";
str1[0]  is 'h'
str1[4] is 'o'

You have to index into the string you want in the array, and then index into that string to get the character you want.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Don't use gcount in your loop, use str[0].length(). Turn your if/else construct into

if(it is A-M or a-m)
    add
    print
else if(it is N-Z or n-z)
    subtract
    print
else
    Print it out

The way you have it, it's too confusing.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

17 and 24, you're not getting the character, you're trying to do that to a whole string. Formulate it like you do in the if statement str[0][i] This is why having an array of strings is a bit confusing, as you're only using the first one anyway...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I was able to make one, but the bad news is that if you have any kind of border around the PB, there are "trails" that are left behind when you move it around (even with double buffering turned on for the form -- could be my graphics card, but I don't think so). So, I can take you through it, but you may need to seek additional help as to how to avoid the trails.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What is the error? Post up your changes to the code with -13.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So since you are using the string array, line 8 will have to look something like str[0][i] >='A' && str[0][i]<='M' since you want to compare characters. That's the ith character of the first string in your array. You also need && instead, since your values will be over that interval.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Post what you are trying to compile currently.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
int get.a(a);

is not correct, and shouldn't be associated with the getcoefficients() method.

The period indicates a member variable and shouldn't be used in a method name like that, just make it int get_a or geta etc. Also, your notation is incorrect (it looks a bit like initializer notation, but this is not the right context for that.

It's sufficient enough to have:

int get_a() {return a;}

as a public member function.

Otherwise, just put int get_a(); and put the other portion in the implementation file.

Go back and look at your text for examples of classes. I think you're got a bit of the idea, but the way certain specifics are handled is important.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Mixing cin and getline like you do can cause problems. Since you press enter after entering in userInputString and cin does not take up that resulting '\n', it stays in the stream and gets taken up by the getline (and interpreted as the end of the input, so control appears to "skip" over it).

See the sticky thread in this forum about flushing the input stream for more details. However, in this case, with one stray '\n' it is probably sufficient to put a cin.ignore(); before your getline statement.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

See my edit above. It's all good, it's just confusing.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

my input is dependent of what Plaintext.txt

Right, but do you really need 100 strings of indeterminant length to do so? I think you're confusing std::strings and C-strings.

0x41 is a memory location

Maybe what you are doing makes sense to you, but it doesn't make any sense to me. 0x41 is not a memory location, it is the hexadecimal equivalent to the integer which defines the letter 'A' in ASCII.

std::string mystr= "hello";
for (int i = 0;i<mystr.length();i++)
   if(mystr[i] > 0x41 && mystr[i]<0x4d)
        mystr[i] +=0x0D //character values, not the pointer value
   else
        etc.
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Rather than working from a clean slate, post up the code that you have now. It's unfortunate that those other forums didn't meet your needs, but you're coming across as a little bit demanding. I know that you don't know everything, but in order to help you, rather than do it for you as the others seemed to do, I also need to know what you are familiar with. Have you used event handlers before? (like MouseUp, MouseDown, and MouseMove)? Post back with some info and someone can help you.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think you are confused, string str[100] is giving you an array of 100 std::strings. Is that what you want?

Bear in mind that characters are just 1-byte ints, so they can be added to or subtracted from:

char c = 'a';
c++;
std::cout<<c<<std::endl; //'b'
c+=2;
std::cout<<c<<std::endl;//'d'

Bearing also in mind that the elements of the string can be accessed by index:

std::string animal= "cat";
std::cout<<animal[0]<<std::endl; //'c'

(note that this is different from the array of strings that you had before where
str[0] would give you the first string and str[0][0] would give you the first character of the first string).

See if that gets you going in the right direction and post back with any difficulties.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, you can access the characters of a string like array elements s[0] is the first character of string s, etc.

Read WaltP's explanation in pseudocode in http://www.daniweb.com/forums/post1461547.html#post1461547 (the rest of that thread may or may not be helpful, but it can give you some ideas).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Lines 83-89 are confusing, what are you trying to accomplish there?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

give me a break

I have a long-standing disagreement with that user, and absolutely none of that was criticism was meant to be directed at you, so I apologize if you got caught in the middle of it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Your romanNum in main is just one character. I'm assuming you're going to want to convert more than that.

setRoman is incorrect, you have no variable name for the parameter and it doesn't really do anything. If you are using C-style strings, look into functions in the <cstring> header like strcpy (copying one string to another) and strcmp (compare two strings).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

How about using a List of lists (could be a list of value structs too):

List<List<String ^> >^ options = gcnew List<List<String ^> >(); 
List<String^>^ strgroup = gcnew List<String^>();
//loop over your file
//Add 3 lines into strgroup
//Add strgroup to options

This way you can access the members of a list with array notation (and the indexes will match up with the SelectedItem property of the dropdown menu).

I didn't compile that so I don't know if the syntax is spot on, but with the list you don't have to know how many you'll have at compile time. You could conceivably use a cli::array also, but I think the list has a more manageable interface.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If he wants to learn he will

He won't if he just copies your code verbatim.

the fact that you got some power to affect someones reputation

That doesn't matter. Even if I had zero rep power, I would still give you the comments (it also helps others to be aware of what you're up to).

Boys with sticks ..

You're the one that needs to grow up and learn to be a part of a community.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You never reassign bodyPos[c] to bodyPos[a], there should be a third line to your swap on line 6-7.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Before you start to do it all by hand, take a look at something like this http://msdn.microsoft.com/en-us/magazine/cc163991.aspx#S3. There are mechanisms in place for internationalization of your application and you can keep the strings right in the ResX file now, rather than using an external config file.

Otherwise, split the strings (String ^ has a split method) that you read in into an array of strings based on =, so you'll end up with: [PL],[String in Polish] so you can sort them out that way.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Oh jeez. Yes! Class members are private by default. Thanks hag++ for having sharper eyes!

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm smart enough to know that!

Wasn't insinuating anything less, lol. It was just that you had said

this simple method call

Are you including the header file or whatnot for class cmd in the file in which you have placed the first two code snippets?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If something is unclear you are welcome to ask.

Yes, why do you keep giving complete, compilable, cookie cutter solutions that the OP can simply turn in for a grade even thought you have been asked more than repeatedly not to do this?

jon.kiparsky commented: Keep hammering on this, it's worth the effort. +2
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

it's much reason to prevent the people who helped me here from getting their solved thread count higher.

Hehe, it is how I make my commission to feed my 10 children. Only kidding -- we'd be happy to keep helping you, it's just it's one of those quirky bugs that seems to pop up intermittently (as your command line parameters shouldn't bring anything to bear on the compilation). Definitely keep it open and see if someone who does SDL on a regular basis has run into this before.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Write a main program that reads in a series of product code

Ah, okay. So all of your input (loops included) should be in main, then. Try implementing the string validation part and post back if you have trouble.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Take in product code as a string rather than an integer, and then verify that all of the characters in the string are digits.

Just as an aside, why are you passing in the value for product code into the function if you're just going to ask the user to input it?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Our posts crossed. No problem :)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Even when I had a DateTime ^ I was not able to find an addHour method (and there was nothing on MSDN about it).

from MSDN

AddHours Returns a new DateTime that adds the specified number of hours to the value of this instance.

You have to make a new DateTime object (or reassign it to itself) to add the hour.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need two DateTime objects, not two DateTime handles (using the ^)

DateTime dt1 = DateTime::Now;
DateTime dt2 = DateTime::Now;

int diff = DateTime::Compare(dt1,dt2);

but again, you can use if(dt1 < dt2)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

dynCurrentTime->Now is a handle to a DateTime object? (DateTime ^) or?

If not, I would just declare a regular DateTime object:

DateTime time1,time2;
time1=dynCurrentTime->Now;
etc.

Then you can use the overloaded < > == operators.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

At least show us something you've started. You have the pseudocode there, now try and transform as much of it as you can into actual C++ code.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm getting a bit confused because it sounds like part of the time you are having problems once you've entered the command and it sometimes sounds like you can't compile the project. You also gave an example program that in no way represented what was really going on...that's forgiven, but it's good to know the whole story.

You also say that this program is being started by another program. Is it possible there's a problem with the other program? If you have to, for the time being, write out the path into a text file and read that into this program to get the filename.

Edit: I had failed to connect you were the one doing .net stuff in your other program, sorry, lol

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If base is a method call it would have to look something like print.base("print"); You can't set a method equal to a string like that (only a member variable named base), and you need the () when calling a method. If this still doesn't solve the problem, post the class definition for cmd.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Show the line where you instantiate print.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I don't have SDL so I can't compile it readily.

Try putting the argument in quotes and/or eliminating the double backslashes -- you should only need those when writing strings in your code, not when entering them in.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

amirite?

No, because you're not always going to have someone to take you through a project step by step before you have to do it. You likely have a textbook and certainly have the internet if you don't know how to do something.

No one is going to give you code without you showing some effort first. If it's object oriented, start by creating an Account class and I'm sure you can get a general skeleton going for your menu system in main.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That's actually probably the least complicated way. What problems are you having in implementing it?