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

Some MS-Windows compilers support conio.h and getch() that will let you access special keys.

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

>>How can you stay away from em? :

Easy -- I have lots of other things to do than waste time on cellphone. Some day people will evolve without voice boxes due to lack of use.

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

Depends on the operating system. Here is one thread you might want to read.

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

Here is a YouTube video about how we celebrate this holiday :)

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

We were all beginners at one time. The only way for you to learn is by coding it yourself, making mistakes, and learning how to correct your mistakes. There is a lot of self-satisfaction in knowing that you can accomplish something.

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

char* str[] is the same thing as char** str; , which is a two dimensional array where both dimensions are unspecified and must be allocated at runtime. char* str[5]; is also a two dimensional array, but in this case you have hard-coded one of the dimensions to be of length 5. That means where is room to store 5 strings of unspecified length.

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

If you use vector<int> then you can use std::sort() to sort the numbers.

start of loop
    read a line
    split line into individual integers and put into vector
    call std::sort
    display values
end of loop

you can do the same with simple int array instead of vector, but then you would have to write you own sort algorithm.

salem13 commented: can you give me a code to do this +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

US politics is so right wing. And yes, I don't get why they stand by israel, that country is wrong.

Why is it wrong for a people to have a county in their homeland? Afterall, they have been in that area of the country for thousands of years as slaves.

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

They are all violent -- do something useful with your life instead of wasting it on stupid games.

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

I think I read that the only difference is in the libraries to support the next generation of Windows.

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

fgets() puts the '\n' at the end of the string because it is in the file. You need to erase it

while( fgets( ... ) )
{
   line[strlen(line)-1] = '\0';  // erase the '\n'
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Fist of all, fscanf() will not give you "black cat" because it will stop reading the file when it encounters the first space, so all it will give you on the first iteration of that loop is "black". Your use of strtok() in this instance is unnecessary because the line will have no spaces.

If you want the entire line, including spaces, you have to call fgets() instead of fscanf(), e.g.

char line[90];
while( fgets(line, sizeof(line), inputfile) != NULL) 
{
    char *tptr = strtok(line, " "); // get first token
    while( tptr != NULL)
    {
       if( strcmp(tptr,"black") == 0)
       {
           // do something with it
       }
       tptr = strtok(NULL," ");  // get another token 
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I don't know where you keep getting the idea that you can cross-post?

From this statement:

>> The only thing changing here is we'll be allowing threads to be posted in all forums, even top level categories.

This whole concept will most likely become clear once it is implemented. I have never used tags so I have no idea how they work.

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

So, the member has new choice: 1) cross post in any forums they wish, or (2) create a thread in one forum and tag it for the other forums.

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

According to your original post, struct node does not contain an item named "data". Post your current, and accurate, code so that we know what the hell you are talking about.

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

When I create a new thread will I have a list of check boxes that I can select which forum(s) apply? That sounds like it could get very confusion real quick. What if someone just checks them all??

If I respond to a thread in one of the forums is my answer going to show up in all the other forums in which the thread appears?

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

[rant]
I'm not voting for anyone who phones me with political message. So if any of those annoying Republican candidates want the job of President, don't call me again. So far, Mitt Romney is on my shit list.
[/rant]

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

TCHAR is a macro -- you can't convert System::String to a macro, it doesn't make any sense. You can convert it to char* or wchar_t*, depending on whether you are compiling for UNICODE or not, but can't convert it to a macro.

See ToCharArray() here

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

how about returning books using CHAR not int it is poissible?

Huh? I have no idea what you mean.

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

There are several programs that could have been used -- Autodisk AutoCAD is among the 15-20 programs.

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

>>#define p printf
>>#define s scanf

Horrible misuse of macros. Don't be so lazy and just type out the word printf and scanf when needed.

>>Link list strings stored rewrite this program

The structure is incorrect. You need to add the star to the declaration making nbook a pointer so that its length can be allocated to fit the size of the string you want to store there.

struct node
{
char* nbook;
struct node *next;
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In that case just either change one of the constructors or add another one.

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

>>display message that input is valid

Well, then just change my previous post a little

beginning of loop
    ask for user input
    if input is valid then 
       display message that input is valid
       exit the loop
    else
        display error message
end of loop
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you read the class description in Resistor.h you will notice that none of the three constructors takes 4 arguments. If you are not allowed to change that, then your only alternative is to change the lines in ResistorMain.cpp by removing one of the arguments so that they match the argument list in the class constructor, probably by removing the 3d argument in lines 26,27 and 28 because none of the 3 constructors have a char* parameter.

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

You may need to rearrange your program a bit, removing the if-then-else statemet.

beginning of loop
    ask for user input
    if input is valid then exit the loop
    display error message
end of loop
display message that input is valid
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Rebuilding DaniWeb is not an option. Ms Dani is in the middle of a major upgrade.

Use code tags to make it retain formatting

[code]

// your stuff goes here

[/code]


If that doesn't work for you then you can just take a screenshot of your computer and attach it to your thread via the Advanced Editor options.

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

I see the same behavior using vc++ 2010 express on 64-bit Windows 7. The memory eventually went back down to normal level after a couple minutes. I think the problem is that the program does not release memory back to the operating system so that Task Manager can see it, instead it just adds released memory to a free-list inside the program.

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

1. delete lines 19-25 because the function prototype is already available in windows.h

line 37: Just like any ordinary C or C++ program functions can not return a pointer to an object created on the stack. A better way to do it is to pass a reference to the object as a parameter void hidden( TCHAR * co, PROCESS_INFORMATION& pi ) then delete line 9.

I get the impression from just the two above errors that you are not very familiar with C or C++ languages. Writing MS-Windows programs is NOT for beginners, it is assumed that you know what the hell you are doing.

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

>> I get an error that says "cannot instantiate an abstract class" even though it is instantiated in a .cpp.

Classes that contain pure virtual functions can not be instantiated o their own -- inherited class must implement the function and the inherited class must be instantiated.

SubdomainPart is not instantiated in any *.cpp file that you posted.

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

First of all you don't have to repeat private before each object. The access modifier is good until you change it to something else

class date
 {
  private:
       int day;
       int month;
       int year;
};

Next, you need to provide the three public constructors that are in your assignment.

You will also have to give the class public set/put methods so that the day,month and year can be changed outside the class.

Add a public method to print the date in the specified formats.

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

Maybe you are confusing EOF with end-of-string NULL terminators? The last character of a standard C or C++ string is '\0', which is called a NULL terminator.

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

Post actual code that illustrates the problem.

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

The derived class just calls the base classes public member functions, they can not change the value of private member data objects or call private functions.

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

That will not work with some languages that must be represented in two bytes.

If the file is in UTF-8 format then the first 4 bytes will represent a binary number between 0 and 0xffff. The table in that link tells how to interpret those bytes. If the first byte does not have a maximum value of 0x0f then the file is not in UTF-8 format. You can assume standard ascii file format, or possibly UTF-16 or UTF-32 format.

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

>>for(int LineCount = 1; !InputFile.eof(); ++LineCount)

That is the wrong way to read input file because eof() doesn' work like that for( line LineCount = 0; getline(InputFile, InputFileLine); ++LineCount) The >> operator doesn't accept space in the input, while getline() does. That assumes InputFileLine is of type std::string.

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

Huh??

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

wouldn't it be a lot easier to just check if the string contains @ and a period? Seems like regex is overkill for this application.

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

>>Partly due to the long hair and beard I've been sporting since my teens

In otherwords, you got married and wify told you either all that hair goes or she does :)

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

Is this an example of what you are talking about?

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

Here is an explanation of utf8 file format. Note that the first two bytes may be a binary integer -- see the chart at the end of that link.

Tygawr commented: Thanks for the link. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>if( line.find( keyword ) ){

Should be this: if( line.find( keyword ) != string::npos ){ >>how to input a way of tracking line numbers.
Just add an integer to count the lines as they are read. Something like this:

int linecount = 0;
...
cout << "line: " << linecout << " " << line << '\n';
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

my guess is that you failed to null-terminate the string

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

can't help you if you don't post the code you have written.

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

'A' - 'P' results in a negative number.

rand() % 16 + 'A'

or
rand() % ('P' - 'A') + 'A';

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
int odd = 0;
int even = 0;
// now prompt for some values not shown here
// I'll leave that up for you to figure out.

// print the values
printf("odd = %d, even = %d\n", odd,even);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Real programmers don't need Intellisense because they have memorized the syntax or know how to read the docuomentation and all that does is slow them down :)

zeroliken commented: right :) +9
PrimePackster commented: That's a advice worth taking..... +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

how to do it will depend on the operating system and possibly the compiler you are using.

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

If you really need to jump all over your program try a safe function like longjmp().

void longjmp (jmp_buf env, int val);
int setjmp ( jmp_buf env );

Wrong. longjmp() and setjmp() are not supported in c++ program. I have used goto on very very rare occasion when within a deeply nested loops of if statements and other kinds of loops are not possible. In my 30 years programming I've used it maybe 2 or 3 times.

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

You are passing item objects to those functions by value instead of by reference. change the function parameter list to use reference & operator so that the item struct will retain its value when control is returned to main()

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

When you see no more old women around you.

LOL :) :) :)All the old women are dead.