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

The first number indicate the minimum width of the field, for example "%2d" will print a number at least two characters wide. If the actual number is only one digit the first character will be a space. If the actual number is more than 2 digits the program will display however many digits are needed to format the number.

>>What does putting the numbers in front do, since it works the same without them
No it does not. Replace the value of i with the number 1 and see how different it is when you replace i with a number such as 12345.

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

also you should use the space bar on your keyboard to format the code better so that it is easier to read, and you may also get a better grade.

And you still have those damed || conditions in the if statements :icon_eek: Your program will never work until you fix that. For example lets assume the grade is 60, your program will give him a B instead of a C. It doesn't really matter what the grade is -- any grade below 90 is a B, even a grade of 0 :-O

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

Going to Ankeny Iowa (about 20 miles North of Des Moines) tomarrow for a 45-year high school class reunion (class of 1962). Our high school was consolidated in 1957 from five surrounding schools. My sister (class of 1958) will also be attending -- I haven't seen her for about 10 years. Leaving tomorrow morning and is about 8 hour drive from where I live and won't be back until July 9th. So of course you won't see me around DaniWeb until after the 9th.

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

Use FindFirstFile() and FindNextFile() to get the list of al the files that need to be deleted. Look in the c++ code snippets and you will find example code. Once you get that going then you can figure out how to program the delete button.

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

To show the total number of A's, B'c, etc you need a counter for each grade and expand those if conditions to tally up the number of people with each grade For example:

int NumA = 0;
int NumB = 0;
int NumC = 0;
int NumD = 0;
int NumF = 0;

if(gradeAvg>=90)
{
    NumA++;
    outFile<< "A";
}

now convert line 26 into a while loop and put all that inside the loop

int NumA = 0;
int NumB = 0;
int NumC = 0;
int NumD = 0;
int NumF = 0;
while( inFile>>stunum>>stuname>>Test1>>Test2>>Midterm>>Final>>Term)
{
    if(gradeAvg>=90)
    {
        NumA++;
        outFile<< "A";
    }
    // remain if conditions go here
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The values in those if conditions (line 36) are incorrect. A grade can not be both > 90 and < 89 at the same time! And if someone gets 100% then your program will give him no grade at all. Line 36 should read simply >= 90. The conditional statements in your original post seem to be correct.

As Salem pointed out all those semicolons will cause huge problems. Edit your data file and remove them.

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

so all C code should compile in a C++ compiler.

No it won't. C++ made several syntax changes such as c++ requires type casts where C does not. Here is a more complete list of differences.

One way to make your code more c++'ish is to replace all printf() function calls with cout that is declared in <iostream> header file and remove <stdio.h> c++ standard header files to not have the .h extension.

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

Ancient Dragon,
I hope you weren't rained out, and that you had a great holiday. My wife and her sister find it physically impossible to not go to Wal-Mart. It is a running joke that neither of them can go on even a weekend trip without a visit to the local Wal-Mart.

:D :D We (my wife and I) are the same way. We did get rain but it didn't spoil the fireworks or BBQs.

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

>>There's no place like home!
I think that's true of most people around the globe.

As for the 4th, I'm working at Wal-Mart today, one of the busiest days of the year. Yesterday was non-stop shopping from the time I went to work at 9:00 a.m. until long after I left. Tons of hotdogs, hamburger and buns went out the door.

Chance of rain this evening which may put a damper on any fireworks tonight.

joshSCH commented: Happy Independence Day! :) +15
arjunsasidharan commented: Happy independence day holy one +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can make it write the output to a file and then your program will have access to it. Or instead of system() use pipe() and your program can read the program's output into a variable such as a character buffer.

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

For the year in DD-MM-YYYY format, convert day, month and year into individual integers then validate each of them. For example month must be between 1 and 12, day must be between 1 and the maximum number of days in the month (create an array of integers that contain the number of days in each month).

For part b), you will have to keep an array of catalog numbers so that it can be checked each time someone enters a new number. If the number they entered is already in the array then display an error message and ask for another number.

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

2 dimensional character arrays can be used to store any list of text items, such as a list of people's names, a list of addresses, telephone numbers, email addresses, etc. If you want a list of 3 names and each name can be a maximum of 20 characters then you would declare the array like below -- since c style strings must be terminated with a NULL character -- '\0' -- you must add one extra byte to the maximum width you want, in this example declare the width as 21 characters.

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

After entering an integer and pressing <Enter> key the Enter key '\n' is still in the keyboard, cin does not remove it. You need to call a function to flush it -- such as cin.ignore() -- after line 47.

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

I saw seen similar constructs several years ago in a VC++ 6.0 MFC program. The parameter to push() mearly creates a temporary instance of the Edge structure and passes that to push().

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

when you invoke int 16 the key is stored in the al register. You must save it someplace else if you need it later. The standard keyboard buffer can contain a maximum of 32 characters and its address is at 0x0000:0x041E.

>>perform something similar to a scanf function in assembly
assembly has no such function.

joshSCH commented: Happy Independence Day! :) +15
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yea, man.. It's been all over the U.S. news the last couple days.. The U.S. did not raise our warning level though.

I live 7 miles from Scott Air Force Base, went there twice today, and I can assure you the military is on hightened alert since the happenings in UK this past weekend.

As for the original post -- I think Tony Blair will fair well in the history books -- He stood his ground and didn't let French President Charic push him around like Charic tried to do. Now if Gordin Brown can be half that good ...

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

I am sorry Mr. Ancient Dragon that you got dragged into it. I was joking when I wrote the edit part. I never edit it. It was part of it from the beginning. Sorry very much.

No problem -- I took it as lightly as you wrote it :ooh:

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

gingerpubes? lol.. I don't get it..

neither do I -- must be a Brit thingy.:)

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

[/B][/I]Oh, my..., :icon_redface: I feel a little shameful of myself. I think I have gone too far.

[Edit] This exercise was conducted with insulting purposes only. If a
moderator feels the need to censure it. I certainly will understand.

Its all gibberish -- you might as well have written Klingon for all I know. No need to edit your post because I found it rather humerous and probably adequately illustrates the point you wanted to get across.

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

why do I get the message in this thread that I must activate my membership before I can contribute ?? Does everyone get that message when viewing closed threads ?

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

And your compiler should produce an error if you attempt to pass more than one byte as that parameter

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

>>How can I draw this line with DrawBreakLine func
did you try calling the function twice -- first time with {0xff,0xff} and the second time with {0x00,0x00} ? If that doesn't work then it probably can't do what you want it to without modifying the function.

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

I think you will have to write a kernel-level program to do that. search microsoft site for the Windows DDK (device driver kit)

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

May I ask you to stop your typical absolutism.

In this case Josh is right -- the 18th amendment did nothing more than create a huge network of illegal alcohol trafficing -- and alcohol use probably increased, not decreased. It was a failed experiement by the religious right in this country to legislate morality.

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

Drug policy of the Netherlands. The way I read this is that legalization of soft drugs did not reduce drug-related crimes at all. People can openly buy soft drugs in coffee houses

So-called coffee shops are allowed to sell soft drugs openly, and to keep supplies greater than the amounts allowed by law for personal use, though they are only allowed to sell individual customers the amount allowed for personal use. The coffeeshops' wholesale suppliers, however, are still criminalized. In theory, the limit of the "for personal use" clause is 5 cannabis plants per person for growing, or possession of 5 grams of hashish or marijuana per household. However, to be prosecuted one would need to possess considerably higher quantities than that. An example of a sentence in 2004 for possession of 360 grams: confiscation and a fine of €750. Coffeeshops pay taxes just like any other business, though there are some special exemptions for them, mostly because they cannot show receipts for their supply of marijuana. Large-scale dealing, production, import and export are prosecuted to the fullest extent of the law, even if this does not supply end users or coffeeshops with more than the allowed amounts. Exactly how coffeeshops get their supplies is rarely investigated

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

try putting two colons in front as shown in this example.

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

moved

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

I think legalisg all drugs and having a state run monopoly on them would cut organised crime by a huge %

yes, but at what cost? do you want your schoolbus driver spaced out on crack, or how about airline pilots ? Or government officials like the Queen and PM ? From what I've seen on TV the House of Lords (I think it is) already looks like a zoo -- and it would be a lot worse if they were all on crack or other drugs. And the flunk-out drop-out rates in schools would skyrocket.

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

>>they should be legal to purchase, possess, transport, produce, and do anything with, with the exception of consumption

If someone does all those things then you can get your boots that they are either drug pushers (prisonable offense) or consuming the drugs too. Drug pushers should be casterated for their crimes.

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

I think it should be regulated like alcohol because from what I understand the affects of marijuana are similar to alcohol. Don't know for certain because I never smoked it.

>>They can get safe needles and everything.
how does that relate to marijuana???

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

google gave 1,400,000 hits for XDE. :-O which one(s) are you talking about.

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

I'm for legalization of marijuana but not other drugs. I have not read anything that indicates marijuana is any more harmful or adictive than alcohol and legalization for recreational use by persons over 21 does not seem to me to be unreasonable assuming the same limitations are placed on marijuana as are currently in place for alcohol.

As for all other drugs, I certainly am against legalization for anything other than valid medical use. I don't want to see a nation of drug addicts as is (was) the case in some nations who legalized them. But we should change our drug laws to be more like Sweden where addicts are hospitalized not tossed in prision. We should clear our prisons of people whose only reason for being in prison is for drug use. Instead we should be providing rehabilitation facilities to help them kick the habit.

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

Your compiler should have given you a bunch of compile errors. Here is the list I got with VC++ 2005 Express (yes I know you are using *nix but your compiler should have given you similar errors).

d:\dvlp\test2\test2\test2.cpp(110) : error C2065: 'm' : undeclared identifier
d:\dvlp\test2\test2\test2.cpp(111) : error C2065: 'n' : undeclared identifier
d:\dvlp\test2\test2\test2.cpp(152) : error C2057: expected constant expression
d:\dvlp\test2\test2\test2.cpp(152) : error C2466: cannot allocate an array of constant size 0
d:\dvlp\test2\test2\test2.cpp(152) : error C2133: 'x' : unknown size
d:\dvlp\test2\test2\test2.cpp(153) : error C2057: expected constant expression
d:\dvlp\test2\test2\test2.cpp(153) : error C2466: cannot allocate an array of constant size 0
d:\dvlp\test2\test2\test2.cpp(153) : error C2087: 'POP' : missing subscript
d:\dvlp\test2\test2\test2.cpp(158) : error C2057: expected constant expression
d:\dvlp\test2\test2\test2.cpp(158) : error C2466: cannot allocate an array of constant size 0
d:\dvlp\test2\test2\test2.cpp(158) : error C2133: 't1' : unknown size
d:\dvlp\test2\test2\test2.cpp(186) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
d:\dvlp\test2\test2\test2.cpp(191) : error C2065: 'pskreddy' : undeclared identifier
d:\dvlp\test2\test2\test2.cpp(191) : error C2143: syntax error : missing ';' before '}'
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>I'm pretty sure wrestling is fake, unless you are referring to mud wrestling.
but the people are real, which was the argument for magicians.....

you mean they are not androids? Now I'm heart-broken :'(

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

fake: "To simulate; feign", and "To engage in feigning, simulation, or other deceptive activity".

illusion: "The condition of being deceived by a false perception or belief"

The two are synonymous words. illusion is just a pretty way of saying fake. That of course says nothing about the entertainment value of their profession. Everyone (almost anyway) knows what they do is fake -- its how they do it that's the mystery.

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

using VC++ 2005 express

int main()
{
unsigned char array[] = {1, 2, 3, 4, 5, 6, 7};
 
// Assembly
__asm
{
    MOV AL,array[0] ; ok
    MOV AL,array+2 ; ok
    lea ebx, array
    MOV AL, [ebx] ; ok
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Can anyone help me in getting information about the other two buttons at the application
Not likely since we don't have the hardware. Sounds like a hardware problem since all the other 5 buttons work as expected.

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

Here is one of several examples I found with google.

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

maybe this will help ?????

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.