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

>>I meant what is wrong.

What is wrong is that the function was declared to return an integer, but it does not return anything. If you don't want that function to return an int then change it to a void function void CountElements() , and if you do that then you can not use the function in the cout statement mentioned in the above post.

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

use google -- I'm sure you will find one.

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

delete line 70 -- yet another useless and sensless statement.

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

what in the world is line 41 supposed to do -- it makes no sense??? Line 42 is pretty much meaningless too.

Very simple to count the number of characters in the array

int count = 0;
for(int i = 0; i < size; i++)
{
    if( a[i]  != 0 ) // if not at end of string
         count++;
}

line 55 is also not going to do anything because variable size was passed by value, not by reference, so the value of that variable in main() will be unchanged when the ConstructSet1() returns.

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

You might have to make a few minor changes to your program, depending on how you coded it. For example

for(int i = 0; i < something; i++)
   cout << "Hello\n";
if( i > 10)
   // blabla

VC++ 6.0 will allow the above code but c++ standards and VC++ 2008 will not because of scoping rules for integers declared inside the for statement.

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

See functions in time.h -- particularly mktime() and structure time_t. Also it's not called "forcasting time" -- that is not forcasting anything. Its just simply advancing to some future date.

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

name_t on line 16 overrides the name_t typedef on line 10. Bad idea.

line 15 could be declared as simply char space = ' '; . No need for the array syntax.

I fail to see why you need first_name to be a two dimensional array of 255 characters each dimension! That's enough for 255 names each name 255 characters long. The world's longest name is only 13 words.

BTW the longest name in the world is "Captain Fantastic Faster Than Superman Spiderman Batman Wolverine Hulk And The Flash Combined. "

According to 1978 Book of World Records the longest sir name was 590 characters.

jonsca commented: Awesome trivia! +2
xavier666 commented: The trivia is what hooked me. Lol +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Put this at the beginning of main() to hide the window and include windows.h ShowWindow( GetConsoleWindow(), SW_HIDE);

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

Turn off UNICODE -- goto Project --> Properties (the last menu item) -->Configuration Properties --> General. Now on the right side, the third item from the bottom is "Character Set". Change that setting to "Not Set"

You could have turned off precompiled headers in a similar way, except under Configuration Properties --> C/C++ --> Precompiled Headers.

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

line 91: use [ and ] instead of ( and )

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

What version of Windows are you running? I don't have the Pro version of that compiler, but Express version does that once in awhile too. When that happens I just do a rebuild all and it compiles ok. I'm running Win7.

Here is a good thread you might want to read about the same problem, and gives a link to Microsoft site where you can report the problem.

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

Those are only a few of the millions of problems I see in your program. Well, millions is a bit of exaggeration :)

Other tips:
use int main not void main. main() always returns an int whether you code it to return one or not.

replace gets() with fgets() because gets() will allow you to enter more characters than the input buffer can hold.

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

I got it to compile with VC++ 2008 Express with only a couple minor changes.

A couple obversations:

1) line 45: code should be declared as int, not char because the scanf() on line 58 expects a pointer to an int.

2) delete all lines that call fflush(stdin) because fflush() is only used to flush output streams, not input streams. Your compiler might support fflush(stdin) but your teacher's compiler may or may not. If your teacher can not compile your program that you will most likely get some marks knocked off your grade. Instead of fflush(stdin) you need to flush the keyboard buffer of '\n' whenever you ask for numeric data entry, such as scanf("%d" ...). One way to do it is like this:

int code;
char c;
printf("Enter something\n");
scanf("%d%c", &code, &c);

3) ditto for fflushall() == that will flush all output streams which you are not using except stdout.

4) Now to the good part. In both Insert() and Search() you are destroying the linked list by changing the linked list's pointer to the top node! Don't do that. The only time that pointer should be changed is if you need to insert a new node at the head of the linked list or delete it.

on line 113 change phone *link to phone link , removing the star. Than change line 130 to this: for(link=*A; link != NULL && stricmp(info->name,link->name)>0; link=link->next); delete line 132.


delete lines 213-218 because …

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

Then just create a new project and select MFC application.

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

LOL! Why don't you just ask someone step-by-step instructions to build a house. I believe most people just use google search engine -- that's what DaniWeb uses anyway. I have no idea how it is implemented, but I'm pretty sure it is not in c++.

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

You can not do it with the Express version because it does not support MFC. Other versions have a wizzard that does it for you.

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

Deposit $1,000.00 USD in my PayPal account and I'll give you the program in about six months.

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

line 5 takes up less memory than line 3. In line 3 each of the strings are allocated 10 bytes of memory, while in line 5 there is no memory reserved for the strings at all in the array.

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

1) provide the full path to the desired destination file

2) system() function, or CreateProcess() win32 api function. There are a few other ways too.

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

Sorry but that is not a quine program (see this link).

A quine takes no input. Allowing input would permit the source code to be fed to the program via the keyboard, opening the source file of the program, and similar mechanisms.

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

The only thing about VC++ 2008 that I do not like (same with version 6.0) is those blasted docking windows. Every once in awhile I accidently undock a window and have a real hard time putting it back into position.

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

The answer was probably in lecture notes.

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

Then by your logic

int i= 2+3*5;

would evaluate to 25 .But it evaluates to 17 that is because the multiplication operation is done first, as it has higher precedence.

No because your original post only involved boolean operators || and &&. As Salem said my statement only applies to the boolean operators.

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

>>I don't want to create a new project and start copying files, if this is possible to avoid.

What kind of project is it now, and what kind of project do you want to change it to? What I might do is create a new project of the type you need then look at stdafx.h and the project settings then change current project to look like those. If all you need is to use mfc support then there may not be very many changes to your current project.

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

I haven't the slightest idea what you are talking about.

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

1) it will depend on how you created the array. If you use <vector> then you don't have to do anything special because it will auto expand as you add data. But if you use something like int* array = new int[25]; then you have to first allocate a new array of the required new size, copy all data from old array to new array, add new item, delete old array pointer, set old array pointer to temp pointer. All that time-consuming processor is why most array managers such as <vector> will actually allocate the array to be larger than that needed to hold the data, such that when you want to add another item the memory has already been allocated.

The way I do this is to have another integer that holds the current size of the array (number elements allocated to the array). When the number of elements used in the array equals this integer then new memory has to be allocated plus some extra for future expansion.

Read this link for .doc and .xls file formats

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

64-bit memory addressing enables applications to store large data sets entirely in memory. This eliminates the performance penalty associated with swapping portions of the data in and out to disk

Yea, that's great ... until the lights go out unexpectently :) But that wouldn't matter if the database is read-only anyway, or immediately saves changes to disk on updates.

Otherwise that was an excellent article.

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

probably g++

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

that is not a character array.

Do you mean like this: char* array[] = {"2.3","5.5","8.9"}; Then just use atof() for each string.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
adnan.siddique commented: you r the best sir +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Statements are always evaluated from left to right unless parentheses change the order of evaluation. Add parentheses to do what you are thinking (j = j || i++) && printf("YOU CAN");

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

Get either Code::Blocks with MinGW compiler or VC++ 2008 Express, both are free. Which to use might depend on what compiler your university has.

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

>>Im still new to TC..
In that case uninstall it from your computer because you can't learn C or C++ from it. Instead, get one of the free compilers available for download, such as VC++ 2008 Express or Code::Blocks with MinGW.

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

call fstat() or _fstat() depending on os and compiler.

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

void main() must be int main().

Why are you using C's fgets() instead of c++ getline() ? Does't make sense to use those C functions in a C++ program.

Example: delete stdio.h, string.h and conio.h from your program as they are not needed.

void contact :: enter()
{ cout<<"Enter First Name : ";
  cin.getline(fname, sizeof(fname));
  cout<<'\n'<<"Enter Last Name : ";
  cin.getline(lname, sizeof(lname));
  cout<<'\n'<<"Enter Address (residence) : ";
  cin.getline(r_add, sizeof(r_add));
  cout<<'\n'<<"Enter Address (office) : ";
  cin.getline(o_add, sizeof(o_add));
  cout<<'\n'<<"Enter Phone No. (residence) : ";
  cin>>phone;
  cout<<'\n'<<"Enter Mobile No. : ";
  cin>>mobile;
  cout<<'\n'<<"Enter Phone No. (office) : ";
  cin>>office_ph;
  cout<<'\n'<<"Enter Fax No. : ";
  cin>>fax;
  cout<<'\n'<<"Enter E-Mail ID : ";
  cin.getline(mail_ID, sizeof(mail_ID));
  cin.get();
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The error is on line 13 of the main.cpp, not car.h. change it to this: std::string myMake="Porsche";

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

i noe dat diz isntaller is very old, but i must have to use diz software.its compulsory! i wank to link with opnet modeler 7.0..

Doesn't matter. You can't have it because it's not free. Have you tried to upgrade your program with VC++ 2008 Express?

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

I'm using Windows 7 and I can't make GetOpenFileDlg() to work. Maybe its deprecated because Microsoft recommends using IFileOpenDialog now. But I'm certain that GetOpenFileDlg() is still support otherwise no program written before Vista would work on Vista or Win7.

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

<string> is where std::string class is declared. <string.h> declares C string handling functions such as strlen(), strcat() etc. It has nothing to do with std::string class.

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

Ignore the first warning about incremental linking -- I get that sometimes too and means nothing.

The second problem, just go to the bottom of the source code file and hit the Enter key so that there is a blank line at the bottom of the program.

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

You don't want that ancient compiler that is nearly as old as I am :) Get VC++ 2008 Express because its free and currently easily available for download at Microsoft. Just google for it.

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

>>You would need to make it the default for it to open when you click on a link in another application.

And just in case you don't know how to do that -- Click Start --> Default Programs (assuming you have not customized the Start menu items)

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

Go to the store and buy it then. We won't help you get pirated copies of software.

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

Happy Holidays everyone :) Wish I could be there to help celebrate. Instead, I'll just drink a beer for you.

~s.o.s~ commented: Cheers! ;-) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

For starters, read this recent thread.

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

Did you try thing: this->panel1->Visible = false;

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

Two main problems:
1) WriteOutput() is destroying the value of result_NameONE and result_NameTWO. Delete those two lines at the beginning of that function because they are set in the Search function.

2) SearchNames() -- the last two parameters must be passed by reference. That function is also much more complicated than it needs to be. Here's another way to do it

void FindName(string names[], int rTotal, string sname, int &count, bool& result)
{
    for(int i = 0; i < rTotal; i++)
    {
        if( names[i] == sname)
        {
            count = i;
            result = true;
            break;
        }
    }
}
void SearchNames(string names[], int &rTotal, string &rNameONE, string &rNameTWO, 
				 int &rCount_NameONE, int &rCount_NameTWO, bool& result_NameONE,
				 bool& result_NameTWO)
{
	/* This is the search function that implements a basic brut force
	   search to find the specified names that the user inputs. */
	rCount_NameONE = 0;
	rCount_NameTWO = 0;

	result_NameONE = false;
	result_NameTWO = false;
    FindName(names, rTotal, rNameONE, rCount_NameONE, result_NameONE);
    FindName(names, rTotal, rNameTWO, rCount_NameTWO, result_NameTWO);

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

I thought VI was just a *nix text editor. Didn't know it was a compiler too.

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

how i can do database in c++

Depends on the kind of database you want to use. It could be as simple as a text file or as complex as interfacing with an SQL-compiliant database, such as MySQL and MS Access. You need to be more specific about what you want to do. SqLite is a good library for programs that do not need sophisticated SQL database needs.