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

It can be done just as easily like this

#include<stdio.h>
#include<conio.h>

struct reco
{
  char acc[6];
  char pin[5];
  float money;
}log;

int main()
{
 clrscr();

 FILE *rec;

 rec= fopen("rec_log.txt", "w");


 for(int i=1;i<4;i++)
    {
     printf("\n\n Enter Account: ");
     scanf("%s",log.acc);
     fprintf(rec,"\n\n Account no.%d : %s",i, log.acc);
     printf("\n\n Enter Pin: ");
     scanf("%s",log.pin);
     fprintf(rec,"\n\n Pin no.%d : %s",i, log.pin);
     printf("\n\n Money: ");
     scanf("%f",log.money);
     fprintf(rec,"\n\n Money: %f",log.money);
    }

    fclose(rec);

 getch();
}//main
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why are you using an array of reco objects? The array is not needed, just re-use the same instance of reco.

The loop on line 19 is wrong -- arrays are always numbered starting with 0, not 1. In your program valid array numbers are 0, 1, and 2. There is no array element number 3, and that may be why your program crashes.

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

Maybe endorsements should be limited to only those members who have made XXX number of posts in a forum. For example I never post in the Java forum so I would not be eligible to receive endorsements in that forum.

ndeniche commented: Excellent idea +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In St Louis where I live ground public transport is very good -- trains and buses run every 15 minutes and are rather cheap compared to cost of driving. There is a train station about 7 miles from where I live, I can park there free, ride the train for $2.50 USD to the airport (about an hour's drive away). If I drove I couldn't even park my car at the airport for that fee, let alone pay the gas to get there. The train was first opened in 1993 and was an immediate hit with everyone. The system has 37 stations and carries over 57,000 people each weekday. People can ride the train free in the downtown area at lunchtime.

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

what error message did you get? Did you add the includes that I posted? what compiler are you using?

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

When you enter a numeric type such as integer or float you have to press the <Enter> key, which is represented in the program as '\n'. Then cin processes the keystrokes one at a time and stores valid numbers in the numeric data. It stops converting when cin encounters the first non-valid character, such as that enter key '\n' and returns control to your program. That leaves the keyboard buffer in an unknown and unpredictable state, so before continuing the program needs to flush out all remaining keys.

In c++ there is an easy way to flush the keyboard buffer, which is explained in detail in that link that Nathan prosted. Yes there is some complicated theory in Narue's article, but the only part you need is at the very beginning

#include <ios>
#include <istream>
#include <limits>

void ignore_line ( std::istream& in )
{
  in.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );
}

With the above, just call ignore_line() after the calling cin that gets an integer or float. For example:

cout<<"Please enter the time(hh mm)"<<endl;
        cin>>task[count].hour;
        cin>>task[count].minute;
        ignore_line(cin); // <<<<< Flush keyboard buffer
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

(Hint: Use the function gets

Fire that teacher! gets() is a horrible function, allows buffer overflow, stack corruption, and possibly crash the whole program. Use fgets() instead of gets() to limit input to the max size of the buffer. fgets() has a couple quirks too, but they can be easily delt with.

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

You are going to have to narrow down the problem a bit more for us -- where is the problem? Don't expect us to wade through hundreds of lines of code to find it ourselves. Ain't going to happen.

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

Well Thanks for reply. But that is not the correct solution because the deseired result is not achieved.

Humm -- I answered the question you asked. Don't blaim me if your program doesn't work right after correcting the problem you asked about.

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

You are attempting to set a pointer to a pointer to itself. That makes no sense at all, something like saying "you are your own father".

Note: main must be declared to return an int. c++ does not allow declaring functions without a return type.

You need to do something like this:

int main()
        {
         sample s; // an object of type sample
         sample *e; // a pointer 
         e = &s;    // set pointer to object
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is it also standard to add 1 to tm_mon,

Yes. Both those are well documented "features" of time.h

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

if _getch() returns either 0 or 224 then a special key such as Function keys, arrow keys, KeyUp,KeyDown, etc was hit. In tha case call _getch() again to find out what key was hit. Here is a complete list of codes. Because Function keys, arrow keys, etc return the same codes as normal keys one way to differentiate between them is to make the codes returned by special keys negative or just add 255 to them. Note: if you add 255 to the value you can not use data type char to hold them because the greatest value that can be stored in char is 127, or 255 in unsigned char.

Here is an example program.

#include <conio.h>
#include <iostream>
using namespace std;

int getkey()
{
    int x = _getch();
    if( x == 0 || x == 224)
        x = _getch() + 255;
    return x;

}

int main()
{
    int x = getkey();
    cout << x << '\n';
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to add 1900 to the year.

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

I hope you're not suggesting young men get casterated!

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

never heard of it. I really love yogurt so from what I see on google I would probably like kefir too.

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

Went to a nearby restaraunt and had pork fritter 12-inch sub and diet pepsi. Brought half home to eat later tonight.

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

Too bad you waited so long to get help.

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

Is that an external hard drive? Or is it a partition of the internal drive?

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

Interesting, apparently I'll never get cancer :)

The fact that capsaicin and other vanilloids are already commonly found in the diet proves they are safe to eat.

This could make development of a drug containing them a much quicker and cheaper process.

But will the new drugs contain a significantly higher dose of the capsaicin that is found naturally in our foods? If yes, then they still need to do a lot of work testing the effects of higher dosages to the human body. If no, then what do we need these new drugs for? Just eat more spicy foods and save billions of money.

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

which part of that don't you understand? Were you paying attention in class when your teacher explained it to you?

rubberman commented: Like your new avatar AD! :-) +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I have two cars, one white and one wine. My grandaughter's car is canaru=y yellow.

can't wait to be 16.

It's not all it's cracked up to be. One day you will blink your eyes and you will be 70.

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

yes, lots of times

have you ever shoveled sunshine?

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

did you see this article?

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

Oh, is that something that the web developer community consider a "standard", or just something someone dreamed up to get a name for himself? I don't know.

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

A square is just a rectangle with all four sides the same length. Are you sure you need separate cases for square and rectangle?

i dont know how to show the users the pervious result,

After getting the value of x save it in another variable. If they want to see previous results just restore x to previous saved value and do the switch statement.

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

Doesn't Endorsements do that?

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

no

have you ever seen Top Grear on TV (UK version)

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

Have you ever been to a strip club?

No.

Have you ever been to an opera?

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

Pancakes with fried egg on top and sugar-free syrup.

exact opposite as LastMitch, I had organic cold milk.

I love Silk Almond milk

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

Read this Microsoft article which explains what the @ symbol is used for. Too bad C and C++ don't have that.

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

Anyone know if Code::Blocks with MinGW has the switches for c++11?

[edit] I just now downloaded and installed CB Version 11 with MinGW. The IDE does indeed have an option to enabout c++11

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

You might want to make a c++ base chass, such as clzss Shape, that contains all the basic data such as parameter, area, etc. Then derive circle, square,etc from shape. In the Shape class you could put methods that are common to all shapes, such as get/set for the data.

Other than some suggestions, no one is going to do all your homework for you. Post the code you have written and ask questions about what you may not understand and others will be more than happy to help you out.

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

Oh, in that case what's the reason for it in the software forums -- suggest Dani remove it there. The only reason I can think where it might be useful is for someone like Davy to write articles. In software programming forums is looks just like Related Forums.

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

Ok, you told us what you are doing but didn't tell us about the question or problem you are having. If it's a stand-alone PC program that doesn't access your web server then there isn't any full-proof way to accomplish that. Whether you write the date to the registry or to a file someone can always change it on their computer. But if you write it to a database on your server then it will be fairly secure from user tampering. When the program starts, if it is a trial version then query your server to find out the expiration date.

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

Yes, I bit him back and he died of human poisoning.

Have you ever been to the top of the Statue of Liberty?

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

What gives with the bold purple text following the code in this thread? It's confusing, and looks like shit. Is that some new formating change made to the forums?

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

So it is -- my apologies. I actually thought that was something called "related posts" because of the dark purple color. Must be a recent change to this forum format.

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

granted but you spent it all in Los Vagas on wine, women and gambling.

I wish I could ride a motorcycle

<M/> commented: Yep :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did you read the whole post !??

Yes I did -- nowhere does it say what the problem is, unless I'm blind or something.

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

That is correct (link) -- the two most common birthdays are Feb 28 and May 21.

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

Depends on where you live. I'm near St Louis Missouri, USA. Shipping may be too high for where you live according to your profile page -- According to this it would cost about $65.00 USD. The US Postal Service wants even more -- $80.00 USD (link). Maybe I could get it to you by carrier pidgon?

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

Granted-- now you have to pay all the bills.

I wish I could remember what I did 5 minutes ago.

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

Granted. You are now serving 100 life sentences in prison for being a cannibal (you didn't say you what you wanted to be famous for :) ).

I wish I were 16 again.

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

I have a copy I no longer want -- if anyone wants it just pay shipping and I'll give it to you. It's in the original box and includes a cd that contains service pack 5.

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

for(i=1 ; lam > 0.002 ;i++)

That looks like a very very dangerous and unpredictable loop. What happens if the value of lam is never > 002? Or if the value of lam becomes > .002 only after the value of i is greater than 400? You need to rethink what that loop is doing.

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

what operating system and compiler? c++ itself it completly ignorant of graphics.

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

I thought it was already date type, not varchar. That makes more sense why it didn't work. As varchar the dates are parsed from left to right just like any other ordinary string. So 5/1/2013 is parsed differently from 05/01/2013 or 5/1/13. To parse varchar like date the string must be in YYYYMMDD or YYYY-MM-DD format. This is also true of file names -- if your program creates file names based on date and you want the files to appear in ascending order then the file names must be in YYYYMMDD format, otherwise they will not be sorted correctly.

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

No

Have you ever been to London?

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

No, but I capsized one when I sat in it :)

Have you ever been on a fishing boat in the Bearing Straight (between Alaska and Russa)?

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

If the order is

5/6/2013
1/1/2012

That is in descending order.

if you want

1/1/2012
5/6/2013

Then you want ascending order, not descending.