Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I won't write the program for you but here is how to declare the array.

char array[3][3];
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since this has nothing to do with any programming languge I'm going to move this thread to Software Developer's Lounge. I don't know the answer to your question.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 48 needs to be inside the do loop, probably just above line 34.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

in c++ use the fstream or ifstream class that is declared in <fstream> and <iostream> header files. fopen() works too, but its declared in <stdio.h> and is C, not C++. Look in cplusplus code snippets and you will find quite a few examples.

>> fopen ("DIR C:\\WINDOWS\\system32\\sol.exe", "\n");
That line is completely wrong. The first argument is the name of the file you want to open, and the second argument is how to open it -- there is no such open flag as "\n" -- that is used on printf() statements to move the cursor to the next line of the screen or create end-of-record in text files. If you want to read the file, here is the correct syntax: fopen ("C:\\WINDOWS\\system32\\sol.exe", "rb"); Since sol.exe is a binary file you will want to read it as binary data, not text data.

Now that line will not actually execute sol.exe but just allow your program to read it into memory using fread() or similar functions.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

see this thread which is the first one listed in these google links.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>How do I get the program to request for a player's name
declare a std::string object to hold the name, then call getline() to get the name from the keyboard.

>>How can I keep track of the user's guesses with a counter
declare an integer object to be the counter then increment it each time the user makes a guess.

>>third question
declare int counters for the number of guesses too low and another for the number of guesses too high.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Now something I wanna crib abt as a smoker.
Like many have said it's bad for non-smokers that others smoke in public places, well I for one surely try to avoid this in the first place. But on the other hand, I can't smoke in place inside my office, in fact I have take a lift go down 3 floors to smoke, I can't smoke inside a theater, I can't smoke inside a train (in India, and it's not uncommon to go on a 24-48 hour train journey given the size of India) or on platform. The list goes on and on. If that's not enough government keeps lengthening the list of "no-smoking" places and increasing tax on cigarettes. In past 5 years my brand's price has doubled ! Remember I have not even mentioned places like Hospitals and Schools..
In all other places where we can legally smoke, there are many non-smokers making faces (even though you are like standing in a corner and trying to save them from the smoke).

It's pure and simple discrimination !

Discrimination, probably, but more importantly the government is trying to force you to stop smoking. The same thing if happening here in USA. And it is a little interesting that governments would force the closure of legitimate industry and put thousands of people out of work.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The method I posted is from C language, while thekashap's method is c++. One is not safer than the other. Which method you choose would be a personal preference but in a c++ program you should probably use the c++ method for consistancy.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Those programs are not compilers -- they are compression which means they reduce the size of the file(s) as much as possible so that they don't take up as much space on the hard drive and reduce transmission time over the internet. Just changing the extension from zip to ico will do nothing -- programs that expect ico files will not be able to read it.

Why do you want to combine a bunch of ico files into one big ico file anyway? after compiling a *.cpp file that contains ms-windows resource file(s) the ico files are not used any more because the compiler will embed them into the *.exe file.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

we don't have the requirements for the program so can't tell you if its right or wrong.

>>Because I have no idea what I'm doing.
If you really coded the program you posted then you know more than what you give yourself credit for.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Did I do anything wrong?
Don't know -- why do you ask?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Of course I'm sure -- I use those programs regularly. How else do you think *.zip files get created.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>"An April 7, 2006 study, British Medical Journal, revealed that secondhand smoke increases the risk of developing glucose intolerance or diabetes.

Oh! First time I head that one and is possibly why I have type 2 diabetes today.

>>blah, those smoking fools don't know what they're talking about
Fools -- yes I agree. It is very foolish for people to smoke.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

pass char** which is a pointer to a pointer, like this

void foo( char ** ptr)
{
   *ptr = new char[255];
}

int mian()
{
   char *ptr = 0;
   foo( &ptr );

   <snip>
   return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What gets banned next?

The next big ban-push is requiring resturants and fast-food places to remove all trans-fat from the food they prepare. That has already started in some states. Get a nutreation list from McDonalds and you will see that most of their food contains some amount of trans-fat. This will be changed in the future.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>. If you're in a restaurant and want to smoke then step outside. Is that fair enough?

No it isn't too much to ask -- nor is it too much to ask a non-smoker to step outside for a few minutes to get some smoke-free air when eating in a resturant that allows smoking. I don't see the difference.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

But what if I WANT to enter such a restaurant WITHOUT those consequences?.

Tough luck guy -- its your problem not theirs. I want to be a multi-millionaire too but Bill Gates won't give me his money. People don't always get what they WANT. Government making laws that bann smoking doesn't make the resuturants public. There are laws about that you can and can not do in your own home while your home certainly isn't public either.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

But it isn't fair that I shouldn't be able to go to a public (yes it actually is public) restaurant

No, they are not public places, at least not here in the United States. They are no more public than any other store/shop/business. They only let you go into their business because they want your money. If the owners don't like you or your money they can make you leave. Wikipedia defines such places as "semi-public". The only public places are those owned by all the people such as government buildings and most (but not all) roads.

Whether its fair or not isn't an issue. If non-smokers want to go to a smoking business (whatever it is) then they are responsible for their own actions -- you know the air is unhealthy for you and choose to ignore that fact so you are responsible for your own actions. The same can be said for employees -- nobody says people have to work under those conditions.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Why does a nonsmoker want to eat in a resturant that allows smoking? Only one valid reason I can think of -- a non-smoking spouse/child of a smoker, and in that case the smoker shouldn't take his/her family there either.

If you don't like the smoke then don't go there. Even when I was smoking there were some resturants I wouldn't go to because the air stank sooooo bad.

People don't have a right to go into any resturant -- that is private property not public property. Owners can bar you from their resturant if they choose to do so as long as they do not volate any laws, such as "No Shirt No Shoes No Service" signs I've seen.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

console program: WinZip, or PkZip, or gzip will do it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>how can i increase the enum type to go from freshman to sophemore etc.
with the assignment operator: x = sophmore;

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Either you are dyslexic or you ought to change your spectacles. Or I missed the joke.
.

LOL: You're right, I misread it. Oh well, I'm glad I quit smoking 6 years ago because I feel a lot better now that I live in a smoke-free home.

WolfPack commented: I quit almost an year ago too. but the craving is still there. :) +10
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

(smoking!=party animal)

That's wrong for two reasons

1. Humans are 100% animal, there's no "partly" about it.

2. I have never seen another creature on this planet who smoked. Humans are the only creatures that do it, and we are supposed to be intellectually superior to all others :-O

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you mean you want to a C program that will copy all the files in the folders you mentioned into another folder? That isn't very difficult if you using FindFirstFile() and FindNextFile(), then for each file found call the win32 api function CopyFile().

>>can somebody do an icon compiling console
Yes I can do it, but I won't. I've given you the functions you need now do the work yourself and post code when you have questions.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No. here is one of many tutorials found with google.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 27-36 are invalid variable names -- variable names can not be numbers. Maybe you just forgot to delete those lines ???

>>“Q” through “Z”, (where “Q” is 0 and “Z” is 9)
that is wrong -- if 'Q' = 0 then 'Z' must be 10 when I count them on my 10 fingers.

>>and the year as the letters “Z” through “A”
How does the alphabet wrap around from the letter 'Z' to the letter 'A' while counting forward ????
I think you need to recheck and verify you posted the instructions correctly. If you did then your instructor is pretty stupid person.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

c-style character arrays can not be copied like you are attempting to do in lines 56-58. You have to use strcpy() to do that

strcpy(temp.w,myArray[i].w);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Easter Sunday = March 22+D+E. (Note-This can give a date in April)

I probably mis-interpreted the result of the calculation in line 25. According to your instructions, easter is the month of March plus the caluculation in line 25. If the value calculated at line 25 is greater than 31 (because there are 31 days in March) then Easter is in April and the day in April is whatever was calculated on line 25 minus 31.

So, you do not need that huge if statement. But simply this:

<snip>
    int sunday = (22 + d + e);//The calculation of easter sunday.
    month = 3; // March
    if(sunday > 31)
    {
        month = 4;
        sunday -= 31;
    }
<snip>

Also, line 24 contains a bug -- should be % 7, not % 34 (see your original instructions).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

the value of gear is getting changed someplace else. Post more code please

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Its not the compiler -- your program contains a bug line 13 -- change the data type to float and it will probably work as expected.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

worked ok for me on Vista using VC++ 2005 Express. If you are using *nix maybe it does not have a pause shell command ???

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Thx but didnt find if u have then send the link

Here is just one of severl threads. Look around on the C board and you will find others

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The calculation for month is incorrect. You can't just simply divide by 31 because not all months contain 31 days. If you do not know about arrays yet then you can get the month with a series of if/else statements, something like this:

if( sunday > 334)
{
    month = 12; // December
}
else if( sunday > 304)
{
    month = 11; // November
}
<snip>
...

I normally have to make myself a chart that looks like below. The first column is the number of days in each month and the second column is the number of days from 1 Jan to the beginning of the month.

31 0	// Jan
28 31	// Feb
31 59	// Mar
30 90	// Apr
31 120	// May
30 151	// Jun
31 181	// Jul
31 212	// Aug
31 243	// Sep
31 274	// Oct
30 305	// Nov
31 335	// Dec
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Do i have to install another release of OpenCV?
No, apparently the file contours.cpp already contains a main() function. You can remove the main() that you added to skeleton.cpp, or remove contours.cpp from the project.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Also, where do the 'if' and 'else' statements come into play with such a program?

The variable sun in that equation is the julian day (1=Jan1, 365=Dec 31) for Easter Sunday. Now you need to add code that will calculate the month, day, and year. The if statement comes in when determining whether the year is a leap-year or not. If its a leap year then February will have 29 days otherwise it will have 28 days.

You should create an array of 12 integers that contains the cumulative number of days from 1 January to the 1st day of the months. For example, Jan = 0, Feb = 31, Mar = 31+28 = 59, April = 59+31 = 90, etc. Then use the sun to determine which of the 12 months contains Easter. If sun = 95 then Easter is in the 3d month (counting at 0 for Jan).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is a link to basic win32 api gui programming. It doesn't teach you how to write games but it does introduce you to adding buttons and other controls/resources to windows.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since you have already started the project and added the *.cpp files you may have to turn off precompiled headers for each individual *.cpp file. In File View select a *.cpp file then turn off precompiled header as previously explained. Do that for each *.cpp file you sdee in File View. If there are lots of files it might be faster and easier to just start a new empty project, turn off precompiled headers, then add the *.cpp files to it.

Another way to resolve the problem is to add #include "stdafx.h" at the top of each *.cpp file (before any other include directives)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can turn off precompiled headers by selecting menu item Project --> Settings, select the c++ tab, in "Category" select "Precompiled Headers" then select the "Not using precompiled headers" radio button.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That error message means that when line line 12 is executed variable x has not been assigned a value yet so it just contains some random value. Programs are normally executed in the same order that you code them, so line 12 is executed immediately after line 11, and line 13 after line 12, etc.

To correct the error you received you need to move lines 18, 19 and 20 up between line 11 and 12 so that the value of x is entered at the keyboard before attemtping to execute lines 12 thru 16.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

A process is a program that is running, a DLL is just a collection of functions or resources that can be used by processes. The contents of a DLL can be shared by many processes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>while (i <= len)

index values range from 0 to but not including len. So just use the less-then operator.

a for loop would be better

for(i = 0; i < len; ++i)
{


}

>>first time I tried failed
post the code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

An array is a sequence of continuous characters. In my Hello example, the first character in the string is 'H', followed by 'e', 'l', ... Each character can be accessed by an index value starting with 0 and ending with the length of the string -1.

std::string word = "Hello";
word[0] = 'H'
word[1] = 'e'
word[2] = 'l'
...
word[4] = 'o'

Now all you have to do in the code you posted is create a for loop and print each character with the loop counter

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't understand what you want -- are you asking how to turn the *.cpp file into *.exe ? How to compile a program ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The string of characters is accessed just like any other array

std::string word = "Hello";

char oneChar = word[0];

Or in the above replace the word[0] with a loop counter such as word.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

ok, lets just start with this, how can i make my program a zipped file on my desktop?

You need to download a program called WinZip -- free evaluation version from here. When you run WinZip it will create a *.zip file that contains whatever you want it to contain.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Reinstall the os -- you DO have the original CD don't you? When you start the cd it will probably ask you if you want to repair the current installation.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are using an editor of somekind, such as Notepad to write your program. Just copy it to the clipboard then paste it into
DaniWeb's edit box, and please surround it with code tags.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I did thatbecause it worked
no it doesn't. This is how it should have been coded

case OAPI_KEY_K: // start
       if (0 ==start) 
      {
             PlayVesselWave3(MySoundID,START,NOLOOP,255,22100);
             start=1;
      }
      else
      {
              start = 0;
      }
      return 1;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

that switch statement you posted doesn't make any sense. If start is 0 why set it to 0 again ? Can start be anything other than 0 or 1 (such as can it ever be 2) ? If not then how does it get set to 1?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is the correction output.open(fileName.c_str());