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

This is the sort of program where a structure or class comes in handy -- makes sorting the data a whole lot simpler.

struct bowler
{
    string name;
    int score;
};

>>However, I want to change it where the "int score" is, so that the user can input the scores manually
use cin inside a loop to do that

for(int i = 0; i < 3; i++)
   cin score[i];
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I'm ill and tired. My face is sweating - rest of me is shivering
Hope you get over that cold soon -- I'm just now recovering from one. It'll probably be another month before I can get a flue shot. We're pretty big on flue shots over here.

Here in USA some schools require lots of math and others don't -- depends on whether the school offers IT programs as part of the math department or business department. Myself, I spent my whole career without using more than algebra and trig. But you will probably need a lot more math if you want to work for games designers and others that make heavy use of graphics. And you will want other courses as well depending on the fields you want to work in -- for example is you want to work in medical field programming for pharmists, chemists, or doctors then you need to know a lot of medical terms. If you want to work for economists and banks then you need a to know a lot about money and banking. Just knowing how to code in a computer language is not good enough -- you need to also know about the field you are working for. Programmers don't work in a vacuum. Choose your college minor very carefully, and possibly get duel majors.

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

I hope britain doesnt turn into america :(

Are you hinting you want to become our 51st state :) You are already closer to being like USA then you probably realize.

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

Your code is missing closing brace and semicolon at the end of the class declaration and before main() on line 58. After correcting that you can probabably figure out how to correct the other one million errors.

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

line 16 is not needed because the file pointer is always set to beginning of file when the file is opened -- line 12.

line 17 is an infinite loop because lines 19 and 20 reset the file pointer back to the 4th byte in the file on every loop iteration. Suggestion: delete line 19 altogether because it isn't needed. Move line 20 outside the while loop, to line 16.

don't use eof() function because it doesn't do what you think it does. Code the loop like this

while( fileopen >> c)
{
   // blabla
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>What is the wrong with this code
Nothing that I know of, other than it doesn't work :) This produces the wrong value, probably because line 10 is only one byte of a 4-byte number.

#include <iostream>
#include <string>
using namespace std ;

int main()
{
    char next4[4] = {0};
    int n = 123;
    memcpy(next4, &n, sizeof(int));
    char_traits<char>::char_type ch = next4[4] ;
    char_traits<char>::int_type int_val ;
    int_val = char_traits<char>::to_int_type (ch) ;

    cout << "int_val = " << int_val << "\n";
    return 0;

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

If you are that new to c++ then there is no way you can complete that project right now. Learn the language first by reading some introduction to c++ books or eboks. Read through the Read Me threads at the top of this board for lots of good links and information. Study hard and in about six months or so you might be able to tackle your project.

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

probably because you have not defined sem_t -- I never heard of it. If its an integer then assigning NULL to it is incorrect -- NULL is used for pointers, just use 0 to initialize integers.

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

you could have read it directly into the integer

long next4;
 fileopen.read (&next4, sizeof(long) ) ;

or you can use the assignment statement

int main()
{
char next4[4] ; 
int num;
while(!fileopen.eof())
{
        fileopen.read (next4, 4 ) ;
        num = *(int *)next4;
}

}

A third way is to use memcpy() to copy the data

int num;
...
memcpy(&num, next4, sizeof(long));
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

ODBC doesn't work directly on wireless (embedded) devices running Microsoft Pocket PC or Mobile 5.0 operating systems. There is at least one commercial dll that will allow mobile devices to send data back and forth to database, but it is quite costly. There is a free DLL from Microsoft that you can get with eVB compiler, but it is pretty darned slow when sending/receiving lots of data. The only other choice I know of, which we took, is to write your own socket program that acts as a bridge (server program) between the wireless device(s) and the database.

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

It is also used by programs when executing other programs. The return value tells the calling program whether it successfully executed its job or not. The return value is useful in a lot of situations, even in Windows programs.

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

its a function and here

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

>>Why does my program stop after the validation
Because you didn't tell it to loop back to the beginning of main(). If you want the program to execute all that code again you have to put the code in a big loop. My suggestion is to put it in another function and just call it from main()

int prompts()
{
   // display prompts and validate -- line 9 thru 155 of the code you popsted

   return choice;
}

int main()
{
   while( prompts() != 4)
   {

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

line 5 should be delete[] Entry

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

K i D\L it soo i see it in the HD but i have to put it anywhere? Its red so icant compile it.. how do i fix it?

Where is it on your hard drive? On my hard drive its in include directory with a lot of other windows header files and libraries. windows.h is not a stand-alone header file but requires several other windows headers also. I have no idea what K i D\L is, but whatever it is it will probably recognize the /I option flag to identify the full path where include fles are located.

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

But then it wouldn't be able to be opened by any Windows machine.

Not correct -- most of the c++ header files do not have extensions and are read/written ok with most windows compilers and text editors. File extensions are not enforced by MS-Windows os. However -- if we're talking about executable files then you are correct, executables have to have .exe or .com extension.

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

Hey can anyone tell me how to make a program that i can have a cmd in the cmd to exacute over and over waiting 1 minute each time?

just use Ancient Dragon's code but replace Sleep(1000) with Sleep(90000).

one minute is 60000 milliseconds, not 90000.

Where to find windows.h on your hard drive depends on what compiler you have. Many compilers don't have it at all and you have to download the (free) Microsoft Windows Platform SDK from Microsoft web site. Its pretty large so if you have a slow internet connection you might want to get it on CD for nominal cost.

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

>>int HotDogStand:: totalSales = 0 ;

this line goes into a *.cpp file, not the *.h file because it actually declares an object.

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

hmm... but what i mean is in the command prompt i tpye in C:/programfiles/blahblahblah so i hit enter. it opens the .exe. So when i hit the arrow up botton it has the same cmd in it.. so what i wanna do is have that arrow go up and exeute it every 90 seconds... so how would i do that?
.

You can't do that directly from the cmd prompt like you described unless you use a scheduler and have it run the command every so often as described by Salem in an earlier post.

The other alternative is to execute the program from the cmd prompt just once and have it do its stuff repeadetly forever -- using loops, something like this: [edit]which is nearly the same as Sturm posted[/edit]

#include <windows.h>
int main()
{
    for(;;)
    {
         // execute some code here, not shown
         do_something();
         // wait one second
         Sleep(1000);
    }
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How do you say Swampthing ?

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

You may use the system function!

That might work with *nix, but not MS-Windows.

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

>>Any heads up message would help me out
Yes -- read whatever manuals the manufacture publishes because there is no standard way of doing it. Some even provide SDKs, some are free and others aren't.

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

without the CD, you will probably have to take it back to the store where you bought it and have them reinstall vista. Or try this

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

>>There are many places where being off by just 1 character can radically alter the behaviour of a program
OMG its sooo true, I've had that happen all too often.

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

>>cannot boot into harddrive what do you recommend
Reformat the hard drive with a low-level formatting tool then reinstall the operating system and all other programs that you lost. Or you could do what I did once -- toss it out the back door and smash it into millions of tiny pieces.

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

Yes, Narue is correct. I misspoke when I said string literals are on the heap. The compilers I have used always places them in global static read-only memory, but string literals could also be placed elsewhere by other compilers.

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

>>How are an object’s data members initialized if a class has only an implicitly defined default constructor
They aren't initialized -- they contain whatever value happens to be there at the time the class object is instantiated. That's the purpose of writing your own constructor.

>>And why a class might provide a "set" function and a "get" function for a data member?
Its really a matter of coding style and good OOP. Class variables should only be changed by functions/methods within the class and not allow others to change them. So make variables either protected or private the write put and get methods to provide appropriate access. This also has the advantage of insuring the class variables are changed in only one place -- if you want to change the class variable you only have to change it in one place instead of all other the program whereever its used. Makes debugging and maintenance a lot easier.

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

count the arguments -- the function at the bottom of your code has 12 arguments but the function prototype at the top has only 9 arguments -- they are not he same function.

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

What do you mean?

he means like this (note I added the asterisks to make, model and plate because all three require character arrays):

void insert(struct node** head, char *make,char *model, int year, char color, char *plate){
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read this I found with google. Apparently that compiler is for a mobile computer, but I don't know for sure.

My guess is that you can forget nearly everything you know about Turbo C++ when working with that compiler. It's a whole different world when working with embedded compilers.

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

The os will take care of it when the program terminates. You don't have to mess with freeing memory for string literals. All you are concerned with is call free() to release memory allocated by malloc(), calloc(), realloc(), or pointers returned by functions that allocate memory by one of those functions. If you are writing MS-Windows programs then there are additional requirements, but don't worry about those either for now.

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

The algorithm you was using may or may not work, depending on the contents of the two input files. It might work if both input files are already in sorted order. If the lines are scrambled in each file then your algorithm can not and will not work. The only way to do it correctly is to read both files into a single array, whether vectors or c-style character arrays, then sort them and write to the final output file

do you know about c-style character arrays of pointers yet ? You can substitute vector for an array of c-strings then sort the strings using some algorithm such as qsort() or a bubble sort (there are lots of other sort options too).

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

I just tried it and it rebotted without problems in Safe Mode. My uneducated guess is that it is probably looking for some device driver -- maybe the video driver -- because in Safe Mode the video seems to be different than in normal mode. When I booted the computer the first time, after turning it off, I pressed F8 and selected "Safe Mode with Network" option. It then continued to boot ok, I used IE7 to test that the network was up and running, which it was, then rebooted. It did not have a problem displaying the normal boot menu this time.

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

Also we normally discourage the use of scanf() with"%s" because it will allow you to corrupt the program's memory by scribbling outside the boundry of the arrays. For example if make is declared as an array of 10 characters and you type 15 characters then scanf() will write the extra 5 characters somewhere in memory -- where is anyone's guess. A second disadvantage of scanf() with "%s" is that it will not capture more than one word -- it stops copying from the keyboard at the first white-space character. So you can not enter a make that has two or more spaces in the name.

The solution is to either get the characters one character at a time from the keyboard buffer (hard way) or call fgets() which will limit the input to the size of the program's input buffer.

char make[10];
printf("Enter make\n");
fgets(make, sizeof(make), stdin);

Now, one disadvantage of fgets() is that it will insert the '\n' character at the end of the input buffer if there is enough room. So you have to strip it back out

if( make[strlen(make)-1] == '\n')
    make[strlen(make)-1] = 0;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Its ok because string literals are in the heap and not the stack. However, because the function is returning a string literal the return value should be declared as const keyword.

const char *throwstring();

main() should be declared as int main() and not leave it up to the compiler to fill in the blanks.

Function prototypes (see line 3 of your post) normally appear outside any function. So you should move line 3 up above line 1.

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

you need to put the information in the input files into one vector, then sort the vector, and finally write the vector contents to the output file. From the example files you posted this will be fairly simple. You can use std::sort to sort the vector after reading from the input files.

Also, do not use eof() because they don't work the way you would expect.

vector<string> theList;
string line;
while( getline(File1, line )
{
   theList.push_back(line));
}
while( getline(File2, line) )
{
   theList.push_back(line));
}
// sort the vector
sort(theList.begin(),theList.end());
// now write the vector out the the output file
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

post a few lines of code that appear before and after the initgraph() function call. Maybe there is something about the parameters you passed that is not compatible with the computer(s) that are failing to run your program.

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

IMO, you need to create a new project and build up slowly this time, copy/pasting small sections of this project to it, along with lots of compile and test as you go.

Yup, I suggested that too, but I suppose some people don't take suggestions like that.

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

forget about the semicolon for now, just concentrate on finding the mismatches braces. Books sometimes contain errors due to poor or inadequate proofreading -- or more likely you copied it wrong.

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

I have the same problem on my self-made computer (Vista Home Premium edition). I don't know what's causing it either. So I've gotten into the habit of not using the restart option but a complete system shutdown then turn it back on after everything stops. That works ok for me most of the time, but I also have automatic Windows updates turned on and sometimes during the middle of the night it will attempt to restart my computer, but fails.

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

Is the server checking the status of the socket connections before attempting to use them?

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

We have no clue what you are asking. Please explain in greater detail and post some code if you can.

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

Ok I loaded your code in a new project with VC++ 2005 Express and found that your Form1.h is missing some braces somewhere. You need to start at the top of the file and count the number of open/close brace pairs and insert the missing one(s). Put your cursor on the closing brace at the bottom of the file then press Ctrl + [ keys and the cursor will jump to the matching open brace.

After adding two closing braces at the bottom of the file (probably in the wrong place I might add) the compiler now spits out a lot of other errors in Form1.h. My suggestion is to begain all over again, create a new CLR Windows project and gradually add the code you posted here a little bit at a time, compile to get clean compile, then add some more.

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

If you use a compiler such as VC++ 2005 (Pro edition) or eVC++ 2.0, or eVC++ 3.0, or eVC++ 4.0 you can have it generate the MIPS assembly code.

>>and print anapshot of the registers and the results
Not sure how to do that because the value of the registers change on every instruction executed.

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

now you have the classes all screwed up. Of course CProfileDlg isn't a member of CGoDlg because its a different class. You made an error somewhere.

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

The link I posted is portable for both windows and *nix, but it was written in C++, not C. I have not read it closely but you might get ideas from that code.

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

win32 api has functions to parse them. Don't know about *nix.

Also, see this article

TkTkorrovi commented: Ancient Dragon is a dishonest person who participated in a serious violation again a person here +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No need to re invent the wheel

this feature is inbuilt to VB 6.0.
Just add an About Dialog from the Add form option .It comes woth a OK button. it comes with all the code.
Just try once.

That isn't what the OP wants -- he wants to know how to get the System Information so that he can display it on his own dialog box or do something else with it. Maybe this will help.

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

Let's put it this way: if everyone knew the answer, do you really think they would put up the question?

Absolutely. Just read any of the books written for Psych 101 classes, they are filled with trivia and answers to questions that are common knowledge.

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

Making your own image of the operating system that is configured and running on a computer is not necessarily illegal. The company I worked for bought a license from Microsoft that allowed them to do just that so that my company could install it on a couple hundred other PCs, making them all run exactly the same identical version of the os. This was legal because Microsoft sold them a license to do it. But its not very likely that an individual at home could afford to buy a similar license. It would be a lot cheaper to just buy another retail license.