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

What is "basics until array" exactly? We don't have your textbook so we have no clue what that means. I can guess, but that won't be much help to you.

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

My guess is that a semaphore is just a system DWORD since all it does is count from 0 to some maximum value. See this link

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

How many characters are on each of the lines in the file? Just 2 characters per line? That's all your program is reading. Post the first few lines of the text file so that we can see what's wrong with your program.

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

Of course fflush(stdout) didn't work because stdout is an output only stream. flush(stdin) worked for you only because your compiler allows it, not because its standard C language.

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

An array's size is only limited to the memory of the machine running the code.

It would be limited to the sizeof(std::size_t) See definition of the new operator

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

Your program is not related to del command, but permissions. Windows 7 doesn't all you to delete files from c:\windows and c:\Program Files folders for security reasons. That doesn't make del a deprecated command.

Working with a folder that you have created yourself and have permissions, to delete all the files in that folder and all sub-folders del /S /Q *.* Now if you want to also remove all the folders rmdir /Q /S <parent folder name> To get online help with these commands del /?

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

Use fflush after your scanf or gets lines.

printf ("Enter the number of student >> ");
    scanf ("%d", &n);
    fflush(stdin) ;

..........

fgets (name[i], sizeof(name[i]), stdin);
	fflush(stdin) ;

..........
fgets (name[i], sizeof(add[i]), stdin);
	fflush(stdin) ;

I gave you positive rep for one of your previous posts -- I want it back! fflush() is only intended for output streams, not input streams, also a few compilers have implemented it for input streams. Never suggest using fflush(stdin) because its non-standard and not implemented by most compilers.

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

>>I wonder what version of Windows Microsoft depreciated del *.* from the terminal.

What makes you think it was depreciated? That command is still alive and well in Windows 7.

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

Instead of closing and reopening the file you can just move the file pointer back to the beginning of the file. Call SetFilePointer()

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

If you use fgets() you will also have to remove the terminating '\n' that fgets() will add to the end of the string, assuming there was enough room in the buffer to hold it.

fgets(name[i],sizeof(name[i]),stdin);
if( name[i][strlen(name[i])] == '\n')
  name[i][strlen(name[i])] = '\0';

or you can do it like this

char* ptr;
fgets(name[i],sizeof(name[i]),stdin);
if( (ptr = strchr(name[i],'\n\)) != NULL)
   *ptr = '\0';
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your loop is going once too many times, 0 <= 5 is 6, not 5 iterations.

char message[1024],t[5];
int a=5;
int i;
for (i=0;i<a;i++) {
    message[i] = t[i];
}
message[i] = '\0';
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Have you used Windows Explorer to verify that the *.exe program is or is not where that message says it is? My guess is that the *.exe was not created. What menu did you use to compile the program? Such as Build --> Build Solution, or Build --> Build <program name here>

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

lines 16 and 18 are wrong, you are passing a pointer to a single character not the whole string. Here's how to code it scanf ("%s", name[i]);

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

All errors have to be corrected before you can attempt to execute it. The compiler will not generate the *.exe (or *.lib or *.dll) file until you fix all the error messages.

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

use a loop to copy from source to destination arrays then null-terminate the destination array. I'm not going to write it for you, you need to figure this out yourself so that you understand it better. Read about loops in your text book or an online tutorial.

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

use single quotes, not double quotes. Surround single characters with single quotes.

t[0] = 'h';

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

what are the errors? Post a few of them.

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

1970s disco music on my IPad

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

don't expect it to run on modern versions of MS-Windows operating system unless you also install DosBox

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

my previous example is the same as yours one...... - but problem isn't in this point - the problem is in fact that the compiler demands main() func for win23 console program when it should use WinMain() func. instead of main()

There is probably some other changes you have to make for win32 projects. I just created a win32 application project and it compiled and ran without error. You should do the same and check the project settings to see what other changes you might have to make in your program.

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

Yes, it does.
Actually if "Enable Microsoft Extensions" option is unchecked, then compiler will issue the message:

If you are compiling a Windows program, make sure you use the /Ze option!

So '-Ze' is a command line option for the compiler which means 'Enable Microsoft Extensions'. Anyways, I'm glad that the issue has been resolved.

I stand corrected, my apologies for the misinformation.

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

I doubt anyone is going to spoon-feed you with line-by-line explanation. If you know enough of c++ then you will recognize most of that code.

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

It does show the console window. It executes main(), not WinMain().

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

I tried using my Galaxy Tab once and found it very difficult to post anything, lots of misspelled words that were difficult if not impossible to correct.

jingda commented: Agree +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

make the change I told you about and your problem will be resolved.

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

That means he is using a different compiler than you are. Just ignore it. Pelles C has no such option.

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

I installed your compiler and discovered the problem you are having. If you want to include windows.h in a console project you have to enable Microsoft Extensions. To to that select menu Project --> Project Options (at the bottom of the list) --> click the Compiler tab, then in the check boxes on the right select Enable Microsoft Extensions.

After doing that the program compiles and runs just as I posted previously without making any other changes to your source code.

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

Post the first two or three error messages.

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

>>The clue is in my username
I would say because of the word "happy" there for has prospered and probably lived long too judging by his photo.

He's happy because he just won some more awards :)

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

You have almost all the code you need to solve the problem. Just add a counter, initialize it to 0, then every time getline() is called increment the counter. That's all there is to it.

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

use a for loop to iterate through the string and count the number of Ts. You need to count both upper and lower cast Ts.

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

you need to build a console project. Most likely your problem is that the program runs correctly but quickly removes the console window when its done and you can not see what happened. Programmers commonly put something at the end of the program to make it stop so that you can see it. Add getchar(); just after line 14 in main()

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

He was a brilliant man, I learned a great deal from his books and lectures.

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

It will depend on the contents of the structure and how it was allocated. Post the structure and appropriate code to get better comments.

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

your program worked correctly for me using vc++ 2010 express. Below is the output I got on the console window. But you need to clear the input keyboard buffer after getchar() to remove the Enter key '\n'.

Please specify the number of the task.
 * You can choose on number from set = {1}
 * Specify "0" to exit
3

 Error(!) = Main menu does not support this command.
 Make sure that your task number is from menu set of commands and try again.

 Please specify the number of the task.
 * You can choose on number from set = {1}
 * Specify "0" to exit

 Please specify the number of the task.
 * You can choose on number from set = {1}
 * Specify "0" to exit
Press any key to continue . . .
vedro-compota commented: ++++ +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

By the time your done with all that beer you will have to destroy all those lines of shitty code you wrote. That would not make me very happy.

sergent commented: You just wrote down my thoughts! +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to copy the characters you want into the new arrays. In your example you will have to declare four character arrays (not pointers!) that are 3 characters each, the 3d one is for the null terminating character. Then just iterate through the original string using either an index counter or a pointer, whichever one is easier for you.

Another way to do the actual copying is to call strncpy() to copy 2 characters from source to destination strings.

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

Lived long: you are over age 45

Prospered: You are happy and satisfied with your life. You have good health and a family who loves you.

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

The following link might help you:

http://reydacoco.blogspot.com/2011/10/linking-to-ms-access-data-source-using.html

Not likely, after 3 years

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

So it seems like I should use a DLL, but how do I use a DLL?

Both static libraries and DLLs are used alike from the application program point of view. They both link to a *.lib file. To use a DLL all you have to do is copy it to one of the folders in the PATH environment variable or in the folder where the application *.exe is located.

If you do not have the *.lib file for a given DLL there is another way to link which does not require the *.lib file. Check out LoadLibrary() and GetProcAddress()

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

You can not hide the class declaration from the application program, but you can put the code that implement the class methods into a library so that the implementation code is hidden from the application program.

There are two kinds of libraries: static and dynamic. Static libraries have *.lib extension and are linked into the application program when the program is compiled and linked. This takes up the most disk space because each application program has a complete copy of the code it uses in the library.

Dynamic libraries on MS-Windows have *.DLL extension. When you compile a DLL the compiler will also generate a *.lib file that only contains the information compilers need to resolve function and data address while compiling the application program. There is only one copy of the code in memory regardless of how many application programs use it, so DLLs require the least amount of memory.

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

I don't know if it will work, but try calling setlocale() for the desired language.

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

What do you do before you start coding/ review/ learn your language or code? what are some websites enhance your brain, or get your brain ready to review.

Well I certainly hope you have learned the language before you start to code a program :)

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

. And a lot of those ideas were stolen-- Bill Gates bought DOS really cheaply and Steve Jobs stole the mouse from Xerox (I think)..

Bill Gates got DOS from IBM so cheaply because IBM didn't know what to do with it and didn't really want it. So yea, you buy something at a huge price that hasn't been developed yet. That's not stealing -- its just good business.

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

Make sure the denominator in that equation is not 0. Print out the value of the variables so that you can verify them.

Also, get rid of those gets() calls such as on line 36 because they can let you enter more characters than the array can hold; the extra characters will be written to some unknown memory location and possibly crash the program. Replace gets() with getline() since you are writing c++ program.

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

>>Assembly was one of the founders of what we today know as programming

Wrong. According to this wiki article programming originated in ancient Greece over 1,200 years ago, although I think China may have developed it earlier then that.

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

The problem is not limited to the UK -- its a big problem here in the USA too, and I assume other countries as well. I know a woman I worked with who was widowed, and within a week was out looking for another man. She found one online who promised here that he had lots of money and would fly to USA and take good care of her. All he needed was $1,500.00 USD for the plain ticket. He also convinced her to give up her job because she wouldn't need it any more. All of us at work (about 50+ people) tried to tell her that it was just a scam and not give him a single cent, afterall if he had so much money why would he need her to send him $1500 for airfair?? Well, she would not listen to anyone, sent him the money and quit her job. Then she waited, and waited, and waited some more, but the man never showed up at the airport and she never heard from him again. And she didn't have a job either. She tried to get her job back but WalMart manager said sorry, but we don't want you back.

Sad story, but people desperate for love to dumb things.

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

You're right -- clicking the Search button just brings up some crazy useless window.

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

>> why they needed to make 2 types of strings, char string and w_char string?

Because there are languages other than English. The alphabet in some of those languages, such as Chinese, can not be represented by one-byte char variable.

There are two versions of all, or most, win32 api functions, one for standard char* and the other for wchar_t*. Microsoft VC++ compilers since version 2005 default string to wchar_t* (UNICODE), and you have the option to change the compiler to use char* instead. If you want to use standard char* strings then just disable the UNICODE feature.