WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

LamaBot, please watch your formatting. We are trying to show by example. Poorly formatted examples tells the poster it's OK to be sloppy...

Your examples are good, we just need to model good practices.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

LamaBot, please watch your formatting. We are trying to show by example. Poorly formatted examples tells the poster it's OK to be sloppy...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Brent, two things.
#1) Your thread titles: read the rules
#2) Your formatting: please pay attention to indentation -- see this

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I get it all the time

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

soul was missing

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Why are you hijacking a 3 year old thread? Can't you start a new thread with your new problem?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

"fflush(null) ;" isn't really mandatory, but lotsa ppl come back quoting problems with printf+scanf usage so...

Even more ppl come back yelling at anyone that uses it improperly like this, too. fflush(null); will accomplish nothing at best, break your program at worst. You cannot flush the null device AFAIK. And it is only used for output, never input, streams. See this

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

TRY THIS OUT

goutham, around here we want the poster to find the answer. We help them with their code, we don't do their homework for them.


stringgader, read the above. In order to get this problem from your instructor, you must know something about code. This can't possibly be your first program.

by the way,, im only new to this programming thing,, tnx again

Duh, really? ;)

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

miniseries

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I understand and believe that I have done what you said about converting by the smallest units first. My main problem is just this: " (2431.23cm = 24M, 31.23cm)."

Like my ex:

double answer1 = 0;
    answer1 = (feet*12);
    inches = (answer1 + inches);
    meters = inches/39.37;
    cout << "There are this many " << meters << " meters and centimeters." << endl;

I first multiplied the feet by inches to get the total number of inches from the feet input. I then added the number of inches entered to reach the total number of inches. I then divided inches by the number of inches in a meter to get the number of meters. And then I divided the inches by this again using the % sign to get the remaining # of centimeters. But according to converters I've used online my answers are always a little off. So I really can't see the problem myself. It seems like I've got it down but something actually is wrong.

Which is larger, meters or centimeters? My suggestion was convert feet/inches to inches (smallest) then convert to cm (smallest). Then it's a simple matter to get the meters. It's less exact to go the way you did.

And because your code is so huge, I'm suggesting starting over and thinking about how to make the program piece by small piece rather than all at once like you have now. A lot of what you have can …

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You know, LamaBot, you don't have to quote every post in their entirety if you aren't going to reference any part of it. And you can edit the quote down to only show the relevant portions you wish to comment on. That would help by not having a 200 line quote with a 3 line reply that has little to do with the quote. Just a thought... ;)

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

in reincarnation deeply

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

She was aghast

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

miserly

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

MTV is a kiddie station.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I'm simply GR8

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

time for a new riddle.

What?!?! We're only allowing 3 hours for an answer? I protest!

If so, as far as I'm concerned, this thread is dead then. :sad:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I think I am making this harder than it needs to be.

Yes you are. Did you read what I posted? It would generate fairly short code. And you don't have to (and probably shouldn't in general) call a calculate function from the input function. Just work on one side of the problem first (say English to metric) then when that's running, add the other conversion.

And indent more that 1 space, please. 3-4 is standard.

And main() is not a void, it's an int

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

ok maybe I didn't explain this right the array has a fixed amount of rows and columns. I am supposed to randomly populate the array with 12 objects
I wanted to identify the objects with a number such as 1. the user is then prompted to guess the location of the hidden objects.

First define your array, kinda like you did: int multi-d[rows][columns] Then fill it with 0's with for loops.

Then loop from 1 to 12 and use LamaBot's idea with rand() to get a location in the array. Check if the location is zero. If so, load the loop value. If not, get another location.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Let's go back to the code in your first post -- in this thread.

#include<stdio.h>
#include <stdlib.h>
#include<conio.h>      [I]//** kill this -- you shouldn't use it[/I]
#include<string.h>
#define MAXLEN 15

FILE *Entrada;
FILE *Salida;
void main()           [I]//** main is NEVER a [B]void[/B], it's an [B]int[/B][/I]
{
 int i,n;
 char s;
 char arreglopalabra[];  [I]//** you never assigned any space.
                         //** I assume this is for the words?  Define the 
                         //** both the max word size and max number of 
                         //** words:
                         //**  [B]char arreglopalabra[MAXWORDS][MAXLENGTH][/B]  [/I]

 char puzzle[];          /[I]/** same here[/I]
                         [I]//**  [B]char puzzle[MAXROWS][MAXCOLS][/b][/I]

 Entrada=fopen("C:\\TC\\BIN\\input.txt", "r");
 Salida=fopen("C:\\TC\\BIN\\output.txt", "w");

 if (Entrada==NULL || Salida==NULL)
 {
  printf("ERROR");
  getch();    [I]//** change to [B]getchar()[/B][/I]
  return;
 }
 else
 {
     while(!feof(Entrada))  [I]//** See [b] this [/b] -- and it doesn't go here anyway[/I]
     {
        //** read the first line (number of words
        //** Loop reading that many words into [I]arreglopalabra[/I]
        //** Don't you need to know the size of the puzzle?
        //** Read each line of the puzzle -- in a loop
        fscanf(Entrada," %d %s ", &n, &arreglopalabra, &puzzle);

        fprintf(Salida, " %d %s ", n, arreglopalabra, puzzle);

     }


 }

 clrscr();   [I]//** get rid of this, too[/I]
 printf("\n %d %s", n, palabra);
 getch();    [I]//** change to [B]getchar()[/B][/I]
 fclose(Entrada);
 fclose(Salida);
}

clrscr() and getch() should not be used -- they are not standard. clrscr() hasn't been used for 10 years (about) so won't work when you get out in the real world. getch() is not defined everywhere (only 2 current compilers) so will also cause problems in the real …

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

The parsing of the input is going to be the hardest thing. Initially, make the input simple. Accept 2 numbers, feet/inches or meters/centimeters.

Then combine ft/in into inches, m/cm into centimeters. Then convert to the other system and split. Switching everything to the lowest value (in/cm) makes the use of doubles easy, no splitting is really necessary (2431.23cm = 24M, 31.23cm). Simple...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

does anybody know how to do this in c language? or to look for its formula? tnx alot,,

Yes, many of us know how to do this. The question is: do you? Or can you figure it out?

If you need help, asking specific questions and posting code you've tried will get excellent answers.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Close....

main()  /**** main is an INT ****/
{
 char option, rtn;
 option = print_header();
 while(option != 'q' && option != 'Q')
 {
/**** display your menu ****/
/****   accept option   ****/
    switch(option)
      {
    case 'a': case 'A': /*Enter team */
         printf("\nPlease Enter a new team:\n");
         break;
    case 'b': case'B': /*Display table*/
         printf("\nLeague Table:\n");
         break;
    case 'c': case'C': /*Match details*/
         printf("\nLeague Table:\n");
         break;
    case 'd': case 'D': /*Exit*/
         printf("\n*** FINISHED ***\n");
         exit(0);
    default: /*invalid option letter entererd*/
         printf("\nInvalid choice, Please try again\n");
     }
   option = print_header();
   }
  return 0;
}

In each case , call a function to process the selection.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

As he was passing a field, Sherman saw a horse in the pasture, calmly eating grass. With Reviak gaining, he decided to try to make it to the horse. But as he approached the horse, he tripped, just as a rock sailed over his head, missing by a hair's breadth.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Fate is a terrible thing to subscribe to.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

His face is

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

fragged

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Anyone that was forn would be dead... He died in 1968. (or he knows a good worm-hole)

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

to get where

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

My favorite mouse is the Logitech G5.

I use a similar optical cordless Logitech. Mine has 2 side buttons and only one under the scroller. GS model I think -- it's a few years old.

My favorite keyboard is this little beauty. The Logitech G11 gaming keyboard.

I haven't found a great keyboard since they moved the function keys to the top row. About two years ago I dusted off an old Gateway 2000 keyboard for a while until the keys started dying. I wanted to get back to the side function keys but discovered my muscle memory atrophied to the point I wasn't using the side keys... Dang it...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

In the edit note, the stamp says something like "Edited 3 minutes ago at 9:15", so give us both! Just add "at [time]" after the new format. IOW, complete the change because both forms are useful.

Dani, Please consider adding "at [time]" to the posting times. I would like to know a little closer than 24 hours when a post was made.

If the time is currently 23:54 and the last post was 1 Day Ago, I would really like to know whether the post was 12:02AM (2 days) or 11:59PM (1 day). And 1 week ago is totally worthless.

I don't mind the AGO info, but I do want some detail...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I would rather people said nothing if they have nothing to say, than feel obliged to say anything.

Me too. Unfortunately... :twisted:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

...what i need help with is how would i go about adding a way off adding more data

for example add a game played always one.
points either 0 for a loss, 1 for a draw or 3 for a win, goals scored and goals scored against

want to end up with a menu system and to be able to do all the options below....so far got B and D sorted out just taking things one step at a time

****************************
* Football League *
****************************
A. Add A New Team
B. Display Current Table
C. Enter Match Details
D. Exit System

Taking one step at a time is the best way to program...

Start with the menu. Put a while loop in main() that
a) displays the menu
b) accept the menu selection
c) executes the appropriate function
d) exits when the EXIT selection is chosen

To add data, do you have a way to store the data for each game won? That would be the first thing. What do you have to save? What are the permissible values? Once you have that, write a function to input the information and load the data.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

OK. I'll bet sourceforge.net has something you can use.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Since he hasn't been back since he posted this request, I guess it doesn't really matter how cool or how easy a method is. He's just wasted our time...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

(sorry word wrap on makes sloppy looking code it doesn't really go on to the next line like that...........

Then stop TABbing so deeply. Use only 4 spaces, not 4 TABs

class monster{
    
    public:
        monster(){}
        void initiate_enemy(int level,lvl_type ctype, int player_x, int player_y,char [50][50]);
        ~monster(void);
        void get_pos(int & xpos, int & ypos);
        void truepos(int & xpos, int & ypos);
        bool move(char [50][50]);
        void take_damage(int dam, int pierc);
        void cast_spell();
        void melee_attack(character player);
        void get_stats(int & health, int & mana, int & dam, int & defence, int & pierc);
        void show_stats();
        bool passable(char map[50][50],direction direction);

        direction facing;
        bool dead;

Like that...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Wow!!! First post and you used CODE tags! Thank You. What is it you know that no other first-time poster can figure out? :mrgreen:

ok need a bit of help.

Good, that's what we're here for...

just tryin to figure a way to add scores and that from there,

Huh? What's that mean?

also the display code seems a bit messy anyway i can put it into a incremental loop?

I suppose...

The code is quite long (obviously) and you give no indication where you need changes. Maybe you need to post only the section of the code you need help with and a better explanation of exactly what you are looking for.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

It would help if you would learn how to use tabs and spaces correctly so that your program is easier to read/understand. As it is few people, if anyone at all, will bother to read it. And what are lines 9 through 11 supposed to do? Must be a copy/paste error.

sorry this is my firsst c++ prgram

So are you going to format your code so we can read it?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
if (month < 0 || month > 12 || day < 0 || day > 31 || year < 1900 ||| year >2099 )

fixed! :cheesy:

Somehow I doubt it... Look at the last ||

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What Narue is trying to say is we can't just fill in any old line of code, we have to know what the code is supposed to accomplish, then we are able to figure out what the line is supposed to be.

In other words,
What is that line supposed to do? What makes you think a line is needed? When we know that, we can figure out what the line is.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

peon

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

"Way down upon the Swanee River!!"

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

between us and

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

as scary as

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

on the subject of IM

im a student so we use it alot :) and i dont know a single person who doesnt use msn

Well, now you know at least 1 ;)

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Develop a program that will determine whether a department-store customer has ex-ceeded the credit limit on a charge account.

Kool. Go for it.

If anyone could hook me up with the solution it would save me from going crazy

Oh! You want us to write it for you because you can't be bothered.... Sure, I'll get right on it. When would you like it?

[edit]And you can't be bothered to write your own post, either. You have to use someone else's -- verbatim? Sad, so sad...[/edit]

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Why use Active-X? Just define a form, it's straight forward and simple.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Except, depending on the code, getchar() is not a direct replacement for getche(). Additional coding may be necessary.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Moderators can be harsh, but with kindness.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Beings from Mars are invading!