mitrmkar 1,056 Posting Virtuoso

Fix the flawed scanf_s() call to be like below:

double getdouble(char item[], double min)
{
...
printf("\nEnter a ticket %s greater than or equal to %d: ", item, min);
scanf_s("%[B]lf[/B]%*c", &ticketquan);
...

Some calls to printf() are erroneous in the same way, i.e. you use %d to output a value of type double.

mitrmkar 1,056 Posting Virtuoso

Just to give some basic ideas, you might do with the following simple setup, without linked lists involved at all.
Use a structure like e.g.

typedef struct 
{
    const char * _pWord; // pointer to the word
    unsigned int _nFreq;  // its frequency
}Entry;

To make it easy, have a fixed size table of Entry structs e.g.

#define MAX_WORDS 123
Entry table[MAX_WORDS] = {0};

and track the amount of used entries by e.g.

size_t nWordsUsed; // Increment when a word is inserted to the table

Write a function that parses the input i.e. splits the string to words, e.g.

void  Parse(char * pWords)

Write a function that handles inserting a word into your table (called by Parse()).

void Insert(const char * pWord)

Finally, use qsort() for sorting the table, you need to write a sort function of your own to supply to the qsort(), e.g.

int mySort(const void * pl, const void * pr)
{
     // Get the pointers to the Entry structs and compare
     Entry * pLeft = (Entry *) pl;
     Entry * pRight = (Entry *) pr;
     // compare ...
     // int result = ...
     return result;
}

In your sort function, first compare the frequency, if that's equal, let strcmpi() do the comparison. For more information on qsort() http://www.cplusplus.com/reference/clibrary/cstdlib/qsort.html
So your main function could look like ...

// global variables .. (here only for simplicity's sake)
Entry table[MAX_WORDS] = {0};
size_t nWordsUsed = 0;
int main(int …
VernonDozier commented: Thoughtful post +1
mitrmkar 1,056 Posting Virtuoso

You can use following:

char *p = "Hello World";
char c = *(p + 1);  // 'e'
mitrmkar 1,056 Posting Virtuoso

We want a few mad people now. See where the sane ones have landed us!

George Bernard Shaw

mitrmkar 1,056 Posting Virtuoso

fscanf() was missing one argument.

int main()
{
	int i=0;
	[B]int d=0;[/B]
	FILE *all;
	all = fopen(FILENAME1, "r");
	while(fscanf(all,"%d", [B]&d[/B])!=EOF)
        ...
}
mitrmkar 1,056 Posting Virtuoso

>> function named MPG which returns the number of miles a car can travel with one gallon of gasoline
MPG() simply cannot be void, because it has to return the requested value.

mitrmkar 1,056 Posting Virtuoso

I would suggest
- first try the 'VCExpress /resetskippkgs' command (after you have located where VCExpress.exe is on your system)
- post your problem to the following forum:
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=26&SiteID=1
and see what they say. (They seem to answer pretty quickly)

BTW, after having taken a look at some of the workarounds provided, the worst case may involve hours of manual work, finding/deleting files and reinstalling, so good luck.

mitrmkar 1,056 Posting Virtuoso

Could it be that comboBox2->SelectedItem is a NULL reference? Calling Box1->push_back() like you do is OK.

mitrmkar 1,056 Posting Virtuoso

After a ver quick look into the code, at least insideTriangle() uses uninitialized variables.

insideTriangle (double base, double height, double p_x, double p_y, double p_find_x, double p_find_y)
{
  double aX, bX, cY, centerY;
  aX = base - p_x;
  centerY = [B]cY[/B] - height; 
  if (p_find_x <= [B]bX[/B] && p_find_x >= aX)
mitrmkar 1,056 Posting Virtuoso

You have to change the initialization of numbers

long count = 0; //counts the number of numbers in the input file
  long items = 0;
  long numbers[count];
mitrmkar 1,056 Posting Virtuoso

It is faster/easier to locate the error spots in the code if you post the compiler errors too.

mitrmkar 1,056 Posting Virtuoso

At the end of the program, try getting the length of the 'name' using strlen() i.e.

...
printf("%c",name[i]);
printf("\nlength of name is: %d", strlen(name));
}
mitrmkar 1,056 Posting Virtuoso

Do you have read access to the file, i.e. you can e.g open it in a text editor?

mitrmkar 1,056 Posting Virtuoso

<deleted>

mitrmkar 1,056 Posting Virtuoso

Google does not help me, because all I can find is how to do this with a struct, not a class.

The difference between a class and a struct is that, with a class everything is private by default, whereas with a struct everything is public by default. So you may want to take another look into the matches you've found by Google'ing.

mitrmkar 1,056 Posting Virtuoso

What is the symptom of it 'not working' ? (Please be more precise about failures when you post).

mitrmkar 1,056 Posting Virtuoso

Try this one as a replacement for the DoModal() introduced in the msdn article (which is for VS 6.0).
I'm not sure whether this one actually compiles with your VS version (I don't have that version at hand now here). A key point here is that your class should have the m_psh member variable.

INT_PTR CMyPropertySheet::DoModal()
{
    m_psh.dwFlags |= PSH_USECALLBACK;
    m_psh.pfnCallback = XmnPropSheetCallback;
    return CPropertySheet::DoModal();
}
mitrmkar 1,056 Posting Virtuoso

Which version of Visual Studio are you using?

mitrmkar 1,056 Posting Virtuoso

how can u convert the month-date-year to a day like monday?

The complete answer to that question is already given in Dave Sinkula's post in this thread (see http://www.daniweb.com/forums/thread109909.html).
Look at closely the output of his program:

/* my output
[B]Tuesday[/B]
Tue Feb 19 00:00:00 2008
*/

The day of the week (Tuesday) is displayed there. Now just study his code to understand how it works.

mitrmkar 1,056 Posting Virtuoso

Remove the & operator, tempString as such must be used in that scanf (tempString is a pointer, hence no need for &).

scanf("%s", [B]&[/B]tempString);

Then allocate memory before copying.

temp->artist = (char*) malloc(strlen(tempString)+1);
strcpy(temp->artist, tempString);

You may want to check that malloc() actually succeeded, (i.e NULL != temp->artist). Also remember to free() all the malloc'ed memory at some point.

mitrmkar 1,056 Posting Virtuoso
const char const * strings[] = {"abcdeedcba\n","abcdxxdcba\n","abcxxxxcba\n","abxxxxxxba\n","axxxxxxxxa\n",
     NULL};
for(char const ** ptr = strings; *ptr; ++ptr)
{
	printf(*ptr);
}
mitrmkar 1,056 Posting Virtuoso

Please post the error message exactly as it is displayed. The computer probably lacks one or more .dlls that your program needs.

mitrmkar 1,056 Posting Virtuoso

Post the code that shows how you have initialized the user struct + buffer and what are the crazy values?

mitrmkar 1,056 Posting Virtuoso

Try seeing which error code WSAGetLastError() returns, error codes are listed in
http://msdn2.microsoft.com/en-us/library/ms740668(VS.85).aspx

mitrmkar 1,056 Posting Virtuoso

Should you check that the SelectedItem is not a null reference.

mitrmkar 1,056 Posting Virtuoso

Basic eclipse c/c++ usage information is given in:
http://www.linuxdevices.com/articles/AT8349506804.html
Hope it helps.

mitrmkar 1,056 Posting Virtuoso
mitrmkar 1,056 Posting Virtuoso

atum.cpp is a source file, not an executable file. You should locate the program you have compiled i.e. the executable file.

mitrmkar 1,056 Posting Virtuoso

Look at the for loop's condition
for(i=0;i<4;i++)
i.e. "i" is not less than four at that line.

mitrmkar 1,056 Posting Virtuoso

If you need to "find the Last "/" in the string" try using the std::string::find_last_of() to get index of the last slash in a string. For details see e.g. here http://www.cplusplus.com/reference/string/string/find_last_of.html

mitrmkar 1,056 Posting Virtuoso

To have your code in e.g. a static library, create a new win32 static library solution. Add your files to the solution and compile. Now you have a .lib that you can ship along with your header file(s) for others to use. See Visual Studio's help on how to take the .dll approach.

mitrmkar 1,056 Posting Virtuoso

what this function mean

operator T*() {return data_;}

It returns a pointer to the member variable data_ of the array class.

mitrmkar 1,056 Posting Virtuoso

Try using the find() from std::string.

mitrmkar 1,056 Posting Virtuoso

Sounds actually strange then, could it be your compiler that is misbehaving ...
Try compiling e.g. producing assembly with source and lookup what actually gets compiled.

mitrmkar 1,056 Posting Virtuoso

Your catch statement in FuncB() is not setup to catch the specific exception that gets thrown from DoSomethingElse(), but the catch statement in FuncA() is.

mitrmkar 1,056 Posting Virtuoso

Here is a quite good explanation for sheets/pages:
http://support.microsoft.com/kb/300606

mitrmkar 1,056 Posting Virtuoso

The error is not in your for loop, it is perfectly OK.
You need to post some more code.

mitrmkar 1,056 Posting Virtuoso

It may prove helpful if you post the error messages that you are receiving.

mitrmkar 1,056 Posting Virtuoso

Hmm, that is a bit inefficient because it calls the strcmp two times with the same parameters,
so I'd suggest you really to use something like:

int result =strcmp(lname, r.lname);
if(0 != result)
{
     // last names differ, return result
     return result;
}
// compare the first names in same fashion
...
// compare the ids
...
mitrmkar 1,056 Posting Virtuoso

STL provides you with the reverse() algorithm.
I.e.

std::reverse(your_vector.begin(), your_vector.end());

You need to #include <algorithm> to make it compile.

mitrmkar 1,056 Posting Virtuoso

You can download dependency walker application from:
http://www.dependencywalker.com/
Open your application in the dependency walker on your friends computer, that way you will see all the files that should be available but are not.
You may have to install some redistribution package on your friends computer.

mitrmkar 1,056 Posting Virtuoso

>> Do have any idea about how you'd format a drive, without prompt
Seriously, you must be kidding now asking for a thing like that ...

mitrmkar 1,056 Posting Virtuoso
mitrmkar 1,056 Posting Virtuoso

Hmm .. shouldn't that first loop be something like

for ( int KPH = 50; KPH <= 130 ; KPH +=5)
cout << setw (5) << KPH << "\t\t" << /* --- KPH converted to MPH here --- */ << setw(5) << endl;
mitrmkar 1,056 Posting Virtuoso

Very shortly about the & operator, it is the bitwise and operator.
See e.g. here http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/ for details.

mitrmkar 1,056 Posting Virtuoso

To get rid of the compiler errors, first remove the items in red

void sort(Student stu[], int parameter, int count)
{
<snip>
      for (int i = 0; i< count-1; i++)
      {
[79]       if(Student[i].compareTo(Student[i+1], parameter) == true)
[80]    {
<snip>
     }
  }
}

and then change the

if(Student[i].compareTo(Student[i+1], parameter) == true)
to
if([B]stu[/B][i].compareTo([B]stu[/B][i+1], parameter) == true)
mitrmkar 1,056 Posting Virtuoso

Try this one, it displays four different styles messages, maybe you get the idea of how message boxes work. The last one prompts you with a question.

#include <windows.h>
int main(int argc, char* argv[])
{
	MessageBox(NULL, "Serious error", "<Message title here>", MB_ICONSTOP|MB_SETFOREGROUND);
	MessageBox(NULL, "Warning", "<Message title here>", MB_ICONEXCLAMATION|MB_SETFOREGROUND);
	MessageBox(NULL, "Info", "<Message title here>", MB_ICONINFORMATION|MB_SETFOREGROUND);

	if(IDYES == MessageBox(NULL, "Click Yes or No", 
		"<Message title here>", 
		MB_ICONQUESTION|MB_YESNO|MB_SETFOREGROUND))
	{
		MessageBox(NULL, "You clicked Yes", 
			"<Message title here>", 
			MB_ICONINFORMATION|MB_SETFOREGROUND);
	}
	else
	{
		MessageBox(NULL, "You clicked  No", 
			"<Message title here>", 
			MB_ICONINFORMATION|MB_SETFOREGROUND);
	}
	return 0;
}
mitrmkar 1,056 Posting Virtuoso

Here is one solution for your compareTo() function

int compareTo(const Record& r) const  //2nd const wont change member variables
{
	// first compare last names 
	int result = strcmp(lname, r.lname);

	if(0 != result)
	{
		// last names differ
		return result;
	}

	// then compare first names 
	result = strcmp(fname, r.fname); 
 
	if(0 != result)
	{
		// first names differ
		return result;
	}

	// then ids
	result = strcmp(id, r.id);

	// nothing more to compare, 
	// just return result whatever it 
	// is now (-1,0 or 1)
	return result;
}
mitrmkar 1,056 Posting Virtuoso

You don't see the name because the code does not output it anywhere, you must add

cout <<  name;

at a proper location.

mitrmkar 1,056 Posting Virtuoso

First of all, you have there two 'main' functions, one for a windows graphical interface application and one for a console application. You only can have one of them, not both. I think you can remove the WinMain() function altogether and use just the 'int main()'.

Actually the main function can be written like:

int main(int argc, const char * argv[])

-argc is number of the arguments that were given to the program
-argv[] is an array holding the arguments that were given to the program

Try out the following small program to see how you can use the arguments. Test it like:
myprog.exe somearg1 somearg2

#include <iostream>
int main(int argc, const char * argv[])
{
       // display all program arguments that it received via command line
	for(int nn = 0; nn < argc; nn ++)
	{      // the first one, at index 0, is actually the program itself, always
		cout << "program argument: #" << nn << ": " << argv[nn] << endl;
	}
        return 0;
}

If you make use of the arguments, you can code your application so that it is given the file to delete as an argument i.e. on command line:
mydelete.exe c:\temp\somefile.txt

Since you are obviously coding on Windows, you can use the DeleteFile() function that is built-in to Windows. It takes only one argument, namely the file path to delete.
Below is one solution ... you can modify it to suit your needs.