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

>>I must use Fork() and Wait()
Why? Sounds like over complication of the problem.

>>myComd is an unallocated pointer which can not be used until you allocate memory to it. IMHO don't make it a pointer; remove the star and replace pointer notation "->" with dot notation "."

>> line 7: #define BUFFER_MAX (50)
Paths can be up to 255 characters.

>> line 26: strncpy(myCmd->name,
Again, you're program is scribbling all over memory because name is an unallocated pointer.

>> myCmd->argv[0] = strtok(NULL, " ");
Wrong. argv[0] must be the name of the program you want to execute -- it can also contain the path.

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

>>ifstream *MyFile;
Remove the * -- c++ streams are not normally pointers.

>>programname = argv[0];
argv is not a variable declared in t CreateAllNodes() function I think you put that function declaration in the wrong place.

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

>>if( argv == "--lines-per-page"
C style strings can not be compared like that. You have to call strcmp() which is in string.h if( strcmp(argv[i],"--lines-per-page") == 0) >>&& i + 1 <= argc

You need to use the < operator, not <= operator. If (i+1) == argc then your program will access outside the valid bounds of the argv array.

>>int lines = 0;
>> int columns = 0;

>>the defaults are 24 and 80, respectively

Make the default value something much more reasonable, such as 24 lines per page and 80 columns per line. You don't want to see a report that has no lines or columns because its an infinite amount of blank pages.

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

It was true a few years ago that VC++ 6.0 was not very standards-compliant compiler. I suspect they got so many complaints about it that M$ decided to make it fully c++ compliant.

The problem with Microsoft compilers is that they do not support POSIX standards. So a lot of code that is written with gcc can not be easily ported to VC++. If portability is important then Code::Blocks with MinGW is probably the better IDE/compiler.

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

Here you go, now all you have to do is fill in the missing parts

#include <string>

class Student
{
   // your code goes here
};

int main(int argc, char* argv[])
{
   // your code goes here
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Is the data structure I used (linked - list ) wrong and not be compatible inside class ?
No -- you should be able to use a linked list within a class

>> Is there another data structure better than linked-list ?
Yes -- use either <vector> (which is an array) or <list> (which is a linked list)

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

Write a Windows Form application and problem solved.

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

In the two arguments to main(), argc is the number of arguments (command line arguments are separated by spaces or tabs), and argv is an array of the strings. So if you type this myprog --lines-per-page 30 argc will be 3 and argv will be
argv[0] = program name
argvp[1] = "--lines-per-page"
argv[2] = "30"

You don't really have to separate the strings because the C/C++ language startup code will do that for you.

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

Is customer_id a string or an integer?

int customer_id = 11;
char filename[255];
sprintf(filename,"%04d.txt", customer_id);
ofstream file (filename);

There are other ways to format the string, but IMHO the above is the simplest.

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

You can't just simply ignore it. You have to read it and then don't use it for anything.

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

WTF?? When did Discussion Groups forum start? And why isn't there a link to it anywhere?

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

>>void matrix_input(int mat[][dim], char* name)
What is variable name? It doesn't make much sense in the context of that function.

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

ive been learning this on my math lesson, so if you want i can give you the math algorythm for this problem, and then you should be able to code that without any problem

There is no math involved.

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

What compiler? Operating system? GUI API ? If you are working with MFC then progress bar isn't all that difficult.

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

move line 11 down outside that loop because it is causing the loop to execute only once.

Is there more to that function then what you posted? Because it is pretty much a worthless function the way it is posted. Why declare an array of 255 Customer classes when you only need two?

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

Too bad I can't give you more bad rep for this.

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

Homework Hummmm. We don't do your homework for you.

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

No we can't because we have no idea what it is.

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

Which those constraints all bets are off. You wrote the OS so you will have to write all the low-level stuff. Does it even support C language? A compiler? How do you run any programs in that os?

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

C language doesn't have a real character data type. char is just a one-byte integer, and all characters such as '=' are treated exactly like integers. You can safely assign '=' to either a char or int data type (also long, long long, __int64, float or double).

You can also perform mathematical operations with characters, such as int numint = ((numstr[0] - '0') * 100) + ((numstr[1] - '0') * 10) + (numstr[2] - '0');

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

struct (or class) students needs an array or vector to hold the individual shares and their quantities.

struct shares
{
    string name;
    int qty;
};

struct students
{
    vector<shares> sh;
    // remaining fields
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Take it in small steps. First write a program that just lets you enter the year. Get that working then add more that lets you enter the month and day of month. If you enter the month as a number you can then create a switch statement that calculates the number of days in the month, as you have already posted.

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

It compiles ok with VC++2008 Express too. I don't have g++ 4.4 so I can't test it.

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

And what do you think the life expectancy of that body of knowledge will be Ancient Dragon?

Its been around for quite a few years (since 1992), so I wouldn't expect it to disappear from use for a long long time. But if you are not interested in portability between MS-Windows and *nix then MFC may be the better choice.

>>I do like the new CodeBlocks dev envr though - have to say that. And it works in Windows just like in Linux.
Yes, I like Code::Blocks too, but still prefer VC++ 2008 because of its superior debugging. But that has nothing to do with building GUI applications.

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

use a loop that counts from 1 to the number you enter, then another loop that counts backwards back down to 1. Print the loop counter.

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

what is the command line to compile something? Or are you using an IDE? Do you know what operating system (e.g. *nix or MS-Windows)?

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

It's not that I know more than you, which may or may not be correct. But I've been here longer, answered more posts, and have been involved in more closed threads. 15 days ago I asked Dani to reduce my rep power because I thought it was just excessive, which she has since done.

Dani has also implemented a voting system where everyone has just one vote per post. My vote counts no more or less than yours. When I give someone rep I also cast one vote. But I can vote without giving rep.

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

what compiler/version are you using ?

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

All code given still has not worked..

Post what you have tried instead of just crying about it.

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

If you are compiling your program for UNICODE then you need to use wcout, not cout. See my example which was compiled for UNICODE. cout doesn't know how to print wchar_t*, which is what TCHAR is converted to.

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

Why was there a post removed from this thread? I was under the impression that Daniweb didn't remove posts. The main argument for this being: "it creates holes in the database". And you were right, it did exactly that in this thread. Jasimp's and AD's posts don't really make any sense anymore.
Better idea would be to snip the text from the posts, but leave the rest of the post there, so people understand to who a reply was made.

I didn't see anything wrong with Josh's post myself, so I don't know why it was deleted.

And did Josh just get banned for this one post?

Probably not. The admins many have permanently banned him

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

put that picture in code tags and it will keep the spaces.

All you need to do is write the function with two simple loops. The outer loop counts the rows and the inner loop counts the columns. Then inside the inner loop call putchar() or printf() to print an 'X'. Don't forget the print '\n' at the end of each line.

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

delete lines 13 and 22 because they are unnecessary global variables.

line 133: why is it reading just the first word on the first line of the file?

Here is how to read that file

// read until end-of-file
while( getline(name, inMyAddress, ',') )
{
        getline( street, inMyAddress, ',' );
        getline( city, inMyAddress, ',');
        getline( state, inMyAddress, ',');
        getline( zip, inMyAddress, ',');
      // now put this stuff in an array or vector
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is the class you posted really what you have on your computer??? Or did you just type it into your post from memory?

Use copy/paste to copy the program into the clipboard then paste it into your post. What you posted above is useless to us.

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

You will need to make three dialog boxes, one for each of the three windows. Each dialog box should nave a Previous and Next button in addition to the text and edit controls. After getting that done you can write the c++ code that makes all that work.

If you don't know how to make win32 api GUI, then here's a good tutorial.

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

You are apparently in the same class as this guy. Why don't you two get together and discuss the problem.

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

>>Am I doing it right?
Maybe. Does it do what the requirements state?

The program needs a switch statement so that it can process each of the menu items.

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

And this differs from using push_back with some "default" strings how?

It doesn't -- unless the strings are read from a file, in which case your example wouldn't work either :)

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

Because that if statement is incorrect. It uses numExs, which never changes. Its unclear what the purpose of that loop is. What is it supposed to do?

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

The problem with Dave's suggestion is all those strings are now stored in memory twice -- once in the array of std::strings and again in the vector of strings. That could be a problem if the computer is low on memory, or the array contains thousands of strings. If there is an array of std::strings then there isn't much point to using a vector to hold the same strings.

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

line 21 is declaring a new integer and hiding the variable you declared on line 12, and that is the one the compiler is complaining about. Rewrite that line like this: for (counter = numExs; counter>0; counter--) then delete line 19.

calypso&noname commented: Very helpful and knowledgeable +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That is awesome :) Just think -- it will put all the book publishers out of business, and all those employees who run the printing presses and distribute the books out of work. Why stop with books -- include newspapers and magazines too. The book store of the future will be nothing more than a tiny room with a couple computers and one of those book publishing machines.

Don't you just love automation?

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

You are confusing the assignment operator = and the boolean operator ==.

line 46: use == operator, not the = operator. Similar problem in other lines of code at lines 60-69. if (leap == true) lines 32, 41,49, and 53: use = assignment operator, not == boolean operator.

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

c = toupper(cin.get()); Or you could just do this: cout << toupper(c);

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

I don't have that registry key, so I used a different one. This works

int _tmain(int argc, _TCHAR* argv[])
{
HKEY hKey = 0;
TCHAR buf[255] = {0};
DWORD dwBufSize = sizeof(buf)/sizeof(TCHAR);

if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\DirectX"), 
   NULL, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
{
        MessageBox(0, TEXT("Can't open key."), NULL, MB_OK);
}
else
if(RegQueryValueEx(hKey, TEXT("Version"), NULL, NULL, (LPBYTE)buf, &dwBufSize) != ERROR_SUCCESS)
{
    MessageBox(0, TEXT("Can't query key."),NULL, MB_OK);
}
else
    wcout << "key value is '" << buf << "'\n";

RegCloseKey(hKey);
cin.ignore();

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

Are you entering them into an integer instead of character array? Yes, then use a series of % and / operators.

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

Line 4 is initializing the vector to have longitud number of elements. Each push_back() will add another item to the end of the vector, which will increase the vector size.

You don't want to use push_back() if you initialize the vector like that. Just use [] operator

for (unsigned i = 0; i < palabra.size(); i++, letra += 1)
{
       palabra[i] = 'a';
}

Also, line 7 is wrong because vector does not have an overloaded << operator. So "<< " " makes no sense.

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

Josh would be ok if he would learn to control his fowl mouth. www.f***france.com would be a site he would enjoy.

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

Read the programmer's manual that came with the touch screen. If you don't have one then contact the manufacturer -- probably download from their web site.