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

that is probably their own function -- there is no such function in either c or c++.

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

did you try right-click on the start bar and select Task Manager from the popup menu?

hammy commented: Thank you for trying to help with my virus +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

did you use "Add/Remove Programs" to uninstall Abode?

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

you must include stdafx.h before any other header files in the *.cpp file(s) -- or turn off precompiled heaters.

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

I wouldn't touch those torrents with a 10-foot pole! How do you know they are safe to install on your computer? For all you know those files are flooded with viruses, worms, etc.

Its only legal to share files if the original autor gives you permission (e.g. license) to do so. Shareware and freeware are normally shipped with a license agreement that specifically states you may give the software to whoever you want. If the license doesn't state that, then it is illegal to get the software unless you spend you hard-earned money for it. Companies are not in the business of giving stuff away, they like to make a profit just like you and I. You wouldn't like it very much either if you wrote a program that everybody wants and that a lot of people steal by downloading free illegal copies of it. The only way to keep companies improving their software is for consumers to buy it, not steal it.

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

that link shows how to add your own menu items to the menu that appears when you right-click on the desktop.

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

Its called Shell Programming Google for "windows shell programming" and you will get other hits too that explain with examples.

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

I turned off pm because someone started spamming me.

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

search google -- that compiler is free for the downloading.

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

garbage in, garbage out. printf() is a function that returns an int which is the number of characters printed. cout is a c++ class that returns a reference to ostream object. printf() and cout are two entirely different things which do something similar but have different return values. Putting cout in an if statement like that is meaningless.

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

If all you wanted to do what check for the file's existance then use GetFileAttributes(). That function returns -1 if the file doesn't exist. Or you could also use _stat() function, which also returns error when file not found.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
void list::add_item(double number)
{
    if (size == max )
    {
               // reallocate the array 
               ArrayPtr m = new ArrayPtr [max + MAX_LIST_SIZE];
              // copy existing data into new array
               memcpy(m, list, size * sizeof(double));
              // delete old array object
              delete[] list;
              // reset list
              list = m;
              // bump array size
              max += MAX_LIST_SIZE;
        }
       // add number to the list
    list [size] = number;
    size++;
}

I'm not getting it. Once I check the size, add it and then count.....else just add the record???

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
if( *src <= '9' )

what if *src < '0' ? isdigit() will catch that, but your if statement won't.

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

you can't control the time because, as you found out, the os will change it when the file is closed.

Not all file systems can record creation and last access time and not all file systems
record them in the same manner. For example, on Windows NT FAT, create time has a
resolution of 10 milliseconds, write time has a resolution of 2 seconds, and access time
has a resolution of 1 day (really, the access date). On NTFS, access time has a
resolution of 1 hour. Therefore, the GetFileTime function may not return the same file
time information set using SetFileTime. Furthermore, FAT records times on disk in local
time. However, NTFS records times on disk in UTC, so it is not affected by changes in
time zone or daylight saving time.

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

in the default constructure allocate the array with max number of doubles.

function add_item is all f**ked up. change the name to list::add_item and delete all its contents.

if size == MAX_LIST_SIZE then reallocate the array, otherwise just insert the new number into list[size++];

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

you can use javadoc notations in any program file written in any computer language. Not sure what program reads them and creates the html file. I had to make javadoc comments in my programs about a month or so ago, but I did not have to create the html files.

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

Anyone know how to deal with this?

change the file extension :?:

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

PDAs often have browsers. The ones I program for do anyway -- Pocket IE on WinCE operating systems.

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

Computer software developed for the public domain, which can be used or copied without infringing copyright. Programmers typically get paid a small one time fee from users who find the software useful.

you worked very very hard to make that post with so many different colors :mrgreen: Is there an editor that will do it for you or did you have to do all that manually :?:

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

That does not supprise me. You cannot just plunk the example code I posted into your program and expect it to compile. You will have to change it to fit in your program, or modify your program to use the code.

The prototype error means that there is a difference between what you put in the class and what you write in the implementation file. Both functions must match exactly (except for virtual keyword if it exists).

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

One last question:
One of the employees informed me that nesting structs inside the class was not good coding practice. How should I clean it up?

that's a matter of opinion, program design, and corporate coding standards. coding a structure inside a class limits the structure's scope to that class. I, for one, see nothing wrong with that and have used it myself.

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

almost

t1 = (time1.hour*60) * time1.minutes;
t2 = (time2.hour*60) + time2.minutes.
diff = abs(t2 - t1);
hours_in_interval  = diff % 60;
minutes_in_interval = = diff/60;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Below is a quick example -- you can get more console functions and a console class here

I compiled and tested this with Dev-C++ compiler on XP os.

#define _WIN32_WINNT 0x0500
#include <Windows.h>
#include <iostream>
#include <conio.h>
using namespace std;

int main()
{
    
    CONSOLE_CURSOR_INFO info;
	HANDLE hOutput = GetStdHandle (STD_OUTPUT_HANDLE);

	// turn the cursor off
	info.bVisible = FALSE;
	info.dwSize = 1;
    if( SetConsoleCursorInfo(hOutput,&info) == 0 )
    {
       cout << endl << "SetConsoleCurInfo failed" << endl;
       DWORD dwError = GetLastError();
       char buf[255];
       FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, dwError,
           0,buf,sizeof(buf),0);
       cout << buf << endl;
    }

    cout << "Press <Enter> when ready";
    cin.ignore();

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

use console functions such as SetConsoleCursorInfo(). see MSDN for details

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

Make it easy for yourself -- convert both time1 and time2 into minutes, subtract them and use the absolute value. No need for all those comparisons.

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

A c++ class is just a way to organize data and associated methods. Whole books have been written on the subject so there isn't enough time or bandwidth to explain them here. I'm sure if you open your text book it will explain them.

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

I just got a VC .NET 2003 compiler and want to learn C# programming. What books would you recommend? I've been reading the book reviews on amazon.com and there appears to be a lot of good books -- or so the readers claim. I'm not at all interested in "C# for Dummies" -- anyone buying that book needs his/her head examined :rolleyes:

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

I finally got it to compile and link -- don't know if it really works or not. Attached it the Dev-C++ projects for the library and the test program that you posted.

I have all my libttif files in c:\downloads\ttif\... If you put yours someplace else you will have to change the project directory settings.

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

Thanks for the link Dave.

Thiru.y: You will have to rebuild the tifflib before you can use it. I'm just starting this myself and have not yet successfully been able to link your program the the library that Dev-C++ produced. I created a static C library, so maybe that is the problem.

First you will have to create your own Dev-C++ library, add the tiff *.c files to it, then compile the library. Dev-C++ will generate *.a file -- libraries on *nix and Dev-C++ have .a extension. I'll let you know when I get a successful build and link.

If anyone else successful with this please post.

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

what is TIFF api? my copy of dev-c++ does not contain tiffio.h

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

the problem with using getline is that it doesn't separate the integers. using your example "23 1 0 55 1" there are 5 integers. but you could use extraction operator to separate them

string n;
in >> n;
int num = atoi(n.c_str());
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

there are a lot of unprintable characters between 0 and 255. Look at any ascii chart such as this one and you see that printable chars start with decimal value 32 (a space) and ends in decimal value 126 the tilda ~. Values above and below those two values may or may not be pritable, depending on the code, or language, set.

So if you try to print one of those non-printable characters to a file in its binary form (which is probably what happened in the text file you posted) all you will most likely see in the file is a funny-looking square when displayed with Notepad. Other text editors may display them as some other symbol or not at all.

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

the digits in the file have to be converted to binary when inserting them into an int array. For example the string "123" can be converted to it like this

char nm[] = "123";
int n = 0;
for(i = 0; nm[i]; ++i)
  n = (n * 10) + nm[i] - '0';

you can also use scanf

char nm[] = "123";
int n = 0;
sscanf(nm,"%d",&n);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what compiler are you using? Your program still has several syntax errors and the compiler should have spit out several error messages. Did you fix them? or just ignore them? NEVER ignore errors and warnings. Nobody can help you very much if you don't post exactly what you tried to compile -- I forgot to being my crystle ball today.

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

always have an antivirus program running on your computer while online. it won't protect against spyware but will catch most viruses. Both Norton and McAfee are excellent. Here are some product reviews.

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

how about writing your own browser? Nothing fancy that will compete with IE6 or Mozilla.

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

I haven't read this whole thread, so I don't know what all those ... mean in your previous post.

did you try to compile it? Obviously not because it contains a few syntax errors, like missing declarations of variables.

when you want to count from 0 to (but not including) 12, most people code it like this:

for(i = 0; i < 12; ++i){
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what is the desired output?

JOVIAN1 m=8.08181550000000040E+001 r=20.D0 d=112595.65

if that last number is what you want, then you have to remove the scientific flag. You can combine some of those setflags by using | operator.

file<<" JOVIAN1     m="<< setprecision(17) << setiosflags(ios_base::uppercase | ios_base::scientific) 
     << j1 <<" r=20.D0 d=" << resetiosflags(ios_base::scientific) << setprecision(2) << setiosflags(ios_base::fixed) << ((j1/JUPVOL) * SOLM2G) << endl;

Also -- srand() (and its variants) should only be called once at the very betinning of the program. you should remove it from that loop.

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

If you don't already have it (and you should have it in your textbook) here is a list of valid escape characters. So, for example, if the character read from the file is a 't', then your program will output "\t".

If the character is non-printable -- use isprint() macro to find out -- then output its hex value

Use fopen() to open the file and fgetc() to read a single character. There are other functions that will also read a single character but fgetc() is probably the easiest to use. The program requirements don't state where to output the characters so I assume just print then to the console (or terminal) screen.

To get started ?

#include <stdio.h>

int main()
{
   // your program goes here

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

thanks i am done with that question.....can you help on this.... read 12 values for double array monthly temperatures from the keyboard......write single statement that perform,,,,

And I suppose you want me to take your classes for you and do all your homework :mrgreen:

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

you have not coded the implementation of interval_since().

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

for floats look again at the cout line in my original post.

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

but in my experience, the majority of teachers only teach because they're not good enough to actually write code for a living.

You must be hanging around the wrong crowd :lol: Many people with Ph.D.s (in computer science) teach because they are over-qualified for jobs. Software houses don't need (or want) Ph.D.s to write code, and masters degree is streatching it. Most teachers that do not have Ph.D. have masters degrees and only teach part time -- they hold down full-time programming positions in industry (I work with someone like that).

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

what speed CPI? how old is the video card?

i have a gig of ram and 200 mb of memory. any suggestions?

which is it? 1 gig or 200 mb ram?

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

Heh, didn't realize that. :p Can you think of any other weird things like that in C?

-Fredric

yes -- one very common problem. fflush() is only defined for output streams, not input streams. Some compilers (like VC++ 6.0) support them, but compilers are not required to.

fflush(stdin);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>some of them work as teachers! LMAO
I have no respect for programming teachers in general. There are exceptions, of course, but for the most part I wouldn't trust a programming "professor" with any language more dangerous than pseudocode

and just who do you suppose actually wrote the language(s)? Those guys have Ph.D. and taught college courses for many years. So you can't judge all teachers on the bases of one idot :lol:

shouvik.d commented: perfect. All those ppl who developed this language were not employed by any S/W company. Instead they researched and brought us something we could use for decades together +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Woah woah woah. What's so illegal with 'i=i++'? Wouldn't it just try to increment i, and then set i equal to the original value of i, making the ++ do effectively nothing? That's what it does when I try it, but I don't have a straight C compiler handy..

-Fredric

wrong. it is undefined behavior. some compilers the final version is the original version but on other compilers it final value is the incremented value. VC++ 6.0 is incremented value, but Dev-C++ is the original value. So, although the statement compiles (no illegal syntax error) it produces behavior that has not been defined by c or c++ standrds.

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

each program has its own memory manager, so when you call free() or delete the memory manager may hold onto the memory in anticipation that you will want to allocat it again. All TaskManager is reporting is the total amount of memory owned by the application -- it has no clue what the program's memory manager is doing with it.

when you call clear() the vector class is releasing all the memory, but that memory is being kept by the program's memory manager, as indicated above. It may or may not be possible for the program to give all the unallocated memory back to the os -- depends on how fragmented the memory bock becomes. memory managers don't normally go to the os on every allocation request -- it first checks its own lists to see if it has an unallocated block big enough to fill the request. If it does, then it will return a pointer to that block, but if not it will request more memory from the os, add it to its list and return a pointer back to your program to that block.

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

Your hard drive might be perfrectly ok. I had something similar happen to me just a couple days ago after an storm flickered the electricity off and on. I have my computer plugged into a power strip -- all I had to do was plug the computer into a different outlet.

The problem could be any one of serveral things -- most likely the computer is not getting any power. First, make sure it is plugged into an outlet that works! plug a lamp into the outlett just to test it.

If that is ok then the problem might be the power supply. But unfortunately most people don't have anything to test that.

If I were you I'd take the computer to a reputable computer shop, or to a friend that knows what he's doing and has the test equipment to work on it.