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

Doesn't anyone know how to write a simple test to figure out something that they don't quite understand?

#include <iostream>
using namespace std;
int main(int ac, char *av[])
{
  int i;
  cout << "Arg count = " << ac << endl;
  for (i=0; i<ac; i++)
  {
    cout << "param " << i << "  " << av[i] << endl;
  }
  return 0;
}

Learn to write these test programs. It will save you hours of pulling your hair out and waiting for someone to answer forum questions.

Celtrix commented: thanks for the info +2
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

if you are using windows then can you use

system("exit");

.
The content inside the bracket of system() is your command prompt instruction.

That's absolutely terrible. What does system("exit"); do better than return 0; . Give you one guess what it does worse...

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

Mostly people would say it's bad practice to use exceptions like you are, but for such a simple program it won't matter.

FYI, most people would have no idea what you mean because if they use it wrong they obviously don't know any better. Without explanation you are just adding confusion.

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

There is no C++ style chosen. The definition in C was changed. Had nothing whatever to do with C++.

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

Since any value of PI you use is by definition inaccurate, you will never get an accurate result.

What value do you expect and what value do you get? Say for tan 45 you mentioned you were expecting 1. You didn't bother to tell us what you got so here are two possibilities:
1) If answer you got was 3 you have a problem with your equation.
2) If your answer was 0.9999999998 or 1.00000001 that's close enough in the computer world.

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

This is the old-style format for function. I used to use them in the early 80's until if found out the style changed.

1) The rules to this style is basically don't use it.
2) Disadvantages -- it will confuse people (look in a mirror :icon_wink:)
2A) Just different
2B) I doubt it
3) Obsolete?
4) standard C

Shows how old that code it, eh?

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

Why would you want to use bit manipulation to do the arithmetic? And how would you use bit manipulation on floats or doubles? Just using + - * / is as easy as it gets.

As for accuracy, what is the value of 1 divided by 3? And what is the digital (binary) equivalent of that exact value? What you will find is the exact value does not exist. Digital representations are inherently inaccurate. Close enough is as close as you can get.

And there limitations on the size of your values using a computer. 16 bits, 32 bits, 64 bits can only hold so much data.

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

How to determine the encoding of a text file?

Text files are not encoded. They are text.

And are there any tools to handle the content of a text file independent of its encoding?

Standard I/O commands.

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

I don't understand. You state:

c)In your program, you have used the system("pause") function. It is recommended not to use this function as this sends a system call to the DOS shell, and tells it to execute the pause function, thus causing a delay in program(although in milliseconds), and using more memory.
You can easily replace it with cin.get() function or with the following code :

cout << "Press any key to exit..."<<endl;
getch();
//Make sure you include the conio.h header file for getch() to work.

So which is it? The normal and acceptable cin.get or the non-standard and frowned upon getch() ?

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

The 5th line of your convert function you are testing for lower case when you should be testing for upper case.

You're welcome.
The Psychic Programmer.

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

Is the PHP Forum broken?

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

You want to floor then /1000.0

You are dividing by 1000 then taking the floor.

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

Describe why. Lot's of answers here, and since you finished the course, you must know how to work with arrays. What's your real problem?

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

Explain the problem in detail!!! Just posting code and expecting us to read your mind is not going to work well.

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

read this

Why are you opening the file as binary if you are using fprintf() ?
After you finish writing your first file, you start reading from it. What's there to read when you are at the end of the file?

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

still missing a feww coding here......

So add the coding.

Since we didn't assign the task and you didn't bother asking a question, we don't know what you need, so we have nothing to say.

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

It's just the same old tired "It's crap", "God loves us all", "Allah [PBUH] is the one true God", interspersed with the odd bit of interesting observation. This however blends into the background after about 90 replies.

I say believe if you believe, don't if you don't. If you're not sure, why the hell not believe? Edge your bets, go to Church, sing your hymns, say your prayers before bedtime. Will it stop you getting a terminal illness, or stop your girlfriend from leaving you? Probably not, but at least you'll still have that superior feeling that comes with being part of a special gang. There's nothing like looking down your nose at people is there?

Yeah, I'm done, too. I was hoping to continue with a discussion of ideas but every time the Bible-thumpers show up it always degenerates into "it's true because I know it's true. Just look at a snowflake to see the the truth. Why do you hate me?"

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

Look again at strftime() -- you'll be able to figure it out.

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

Copy the characters from the old string into a new string with the appropriate separator at the appropriate time.

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

First your claim is wright withe some corrections

Who are you talking to? If it's me, then why are you contradicting me?

If you need more clarity at any point I'm more than welcom.

OK. Please clarify. I'll start with your first statement:

1- the bible was not written by humans ,the bible was the book from god to jesses to guide his people to the right way, the way of light.

So who wrote it? Who put pen to paper and made the words?

Who's jesses?

What light? The sun? The moon? Stars? The oil lamp in the church tower?

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

And why would you want to bother doing anything like this?

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

That is not proof of existence. That is justification.

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

As I pointed out before, since you are not an Admin, let the Admin deal with these matters. They are going to anyway, so you don't need to post at all.

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

There is more to a human being than just a brain, a mind, a heart, intelligence and so forth.. there is a Spirit.

God is real and that is a fact.

Sorry, but I have to say it: prove it.

A belief is not a fact without concrete evidence. All you can truthfully state is you believe there is a Spirit, and you believe God exists. The fact of God and Spirit cannot be proven. This does not mean they don't exist, it just means, at our current level of knowledge, their existence is not absolutely known.

You may 'know' they exist, but that is still a belief, not a fact.

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

I think it's criminal to charge for luggage at all.

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

First, one obvious reason is your claim that you are a confused Christian. Confusion is the work of Satan, and he can always work darkness and deception against anyone who is confused. You must settle in your heart and mind that the word of God is inspired by the Holy Spirit, who told it to the writers of the bible originally. Second, you must get your understanding and revelation knowledge from the Holy Spirit, not some counsel of carnally minded men. Third, never compare the bible to the Qu-ran or any other religious book. The Qu-ran was given by an angel ( supposedly Gabriel ), who choked the prophet Muhammad into submission first, and then gave him what is known as the Qu-ran. Paul the apostle warned about angels giving a different gospel to us that what he preached in Galatians 1:6-9, so take that warning seriously. John 14:26 says; But the Comforter, [which is] the Holy Ghost, whom the Father will send in my name, he shall teach you all things, and bring all things to your remembrance, whatsoever I have said unto you (American King James Version). Let the Holy Spirit eliminate all confusion, and receive the truth from Him concerning the bible, not anyone who says something from their reason and logic.

Assuming you believe in Christianity in the first place. If you don't, there is no Satan, Holy Spirit, angels -- at least not as described by the Bible. For those that follow the teachings of …

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

Actually, I more agree with John than Lisa. Not completely, of course. IMO, email as currently designed needs to be shot (read redesigned). Looking at his points:

1. The ever-changing address.
For professional email addresses, his complaint is stupid. I understand where he's coming from, but the problem people here are those that use their job address as their personal address. If they don't want a personal email address, they should only use email for job purposes.

And his argument about emails from yahoo and gmail, he's right. How am I supposed to find my friend John Doe when his email address is jman1035734@whatever.com?


2. The Spam conundrum.
This is the main area why the email concept is majorly flawed. Remove spoofing in all it's forms. If the sent from address is not accurate, it should not be allowed. Period. I can't stand getting emails hawking products and the email was sent by me!

Fix this! Or kill email!


3. The empty box.
4. The e-mail tourist.
5. The dead-box syndrome.
Not a reason to kill email. But a reason to kill the address.

And with his 5th point, to be honest, regular mail is just as bad - in reverse. My wife just got a letter addressed to her using her maiden name. We were married 16 years ago! Isn't it about time that name was removed from mailing lists?


6. …

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

I've only read the first few pages of this thread. Outside of the Bible-bashing and God-bashing statements that make worthless claims rather than debatable points, there are some good points, and flat out wrong information.

Disclaimer: Many of my points have not been fully researched by me as I am not a biblical scholar, but I have seen some research that I am relying on. Most, if not all, can be found on the web.

First, to your post (FYI - using LIST tags makes responding difficult...)

First of all, I am a confused christian, and I am creating this thread to see if I can clear out some fog in my head. So lets start.

Claim: The bible is false in the sense that it was not written with the guidance of "god"

The way I say it:
"Did God create Man? Or did Man create God". IOW, If there is a God, enough said.
But if there isn't, Man needs something to believe in, other than we were just an accident of nature. So God was created to answer the unanswerable.

Reasons for my claim :

Originally there was a lot of contradiction in the bible because it was written by humans

  • These contradictions were refractor-ed by a humans, specifically some committee of who's name I can't recall
  • No claims, if it wasn't for all of these refractor, more and more people will be aware of such contradiction and hence people will start …
frogboy77 commented: IOW is that short for Iowa? +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

*(mpg+ctr) is basically the same as mpg[ctr] Tearing it apart:
mpg points to the array.
mpg+ctr points to the ctrth element in the array.
*(mpg+ctr) therefore is the value at the ctrth element

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

i want to make rot13 encryption
this program convert ascii code from a caracter, and work only with uppercase character (65-90)

Think it might have something to do with if ((int)input[i] < 65 || (int)input[i] > 90) :icon_question:

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

Here's a better loop to fully understand exactly what keys do what:

while (ch != 0x1B)  // exit on ESC
{
    ch = getch();
    printf("%02X ", ch);
}

Watch the output carefully to see what keys use 2 chars.

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

Start at both ends using 2 index values
If a character is to be ignored, just inc/decrement the index and restart the loop.

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

hi
help me in resolving these questions

Sure.

Open your book.
Read each chapter.
Look at question #1.
Look up how to do a factorial.
Write the code.
Look at question 2.
Figure out an exchange rate.
Use that rate in a program to convert currency.
Continue....

NathanOliver commented: Great Advice +9
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What's a loop? What does a loop do when it reaches the end of the loop? How does the loop stop?

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

The way you wrote the code, it always returns to the menu. Remove the loop and it won't return to the menu.

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

\n

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

Multiple things: srand((unsigned)time(NULL)); should be at the beginning of the program, in main()

Desk-check your program to see what value (aux<=100-complexity) is going to be at various times through the loops.

int lowest=0, highest=100;
int range=(highest-lowest)+1;
aux=lowest+int(range*rand()/(RAND_MAX + 1.0));

Why this convoluted equation when all you want is a 1 or 0 in each cell?

for(int i=1;i<=dim1_save;i++){
  for (int j=1;j<=dim2_save;j++){
    if(aux<=100-complexity)
      matrix_save[i][j]= 0;
    else {
      matrix_save[i][j]= 1;
      count=count+1;
    }
 }

Where do aux and complexity change to make the IF do something different while looping?

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

What you've written is really a C program. I suggest that you either rewrite it in C++ or ask your question in the C forum.

Since he's new to C++, I'm sure his instructor has been teaching the rudiments of C++ (which is C in his mind) and not explained the difference between the languages. Therefore, what he posed is C++.

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

Your IF statement is always true. Write a truth table and see why.

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

and if you don't need the command line parameters for your program, explain again how it's better and should always be used?.

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

hi all,

I have this minor problem which is making me go cranky at the mo..

Do other problems make you a little Larry, and others Curly? :icon_rolleyes:

Below is the code which I am working on which takes the test sample values stored in my test 2D array subtracts the centroids stored in centroid 2D array and stores it in temp1 1D array where temp1 goes from 1 to 4. The values in temp1 array are now squared, summed up and storee inside temp1 array again and does this for 2308 times (CLEN). I want to know how I can increment my h index without using another for loop. Where do I initialize it. Before the i for loop or before j for loop?? Please help!!!

Depends on what you are trying to accomplish. Since you calculate values and put them all in temp[h] , it's' difficult to know what you are doing. Maybe an example of the first 12 or 16 temp values (with description) would make your intentions clear.

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

#INCLUDE <IOSTREAM.H>
#INCLUDE <CONIO.H>
#INCLUDE <GRAPHICS.H>
void main()
{
CLRSCR();
GOTOXY(1,25);
}

:( So much shouting... So much anger... This used to be such a happy place... :icon_twisted:

jonsca commented: I was going to put in a dos.h just for you. +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Hey, this is neat! I tried to open this thread in IE to check the problem out and "Internet Explorer cannot display the webpage" is displayed! And i can use the button to "Diagnose Connection Problem"!!!

Leave it to ol' Microsludge to not even work...

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

> You're fine until they make a rule banning sarcasm.

Ha ha ha. :)

Thanks for the explanation. Lot clearer now.

OK, that's it. Time to ban ardav for overuse of sarcasm. Clearer my ... :icon_twisted:

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

Is there really any other kind? ;)

Yeah, LISP. It'th all parenthetheth. No bracket'th at all. :icon_twisted:

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

Then search the web for the site that defines/creates this video format. Ask them how to convert it.

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

CANNOT USE THE POW() FUNCTION.

Why are you shouting at us? Do you really think we can't understand you unless you shout?

ANY HELP APPRECIATED!

What again? Why would you need to yell at us again!?!!?

Do not write in all uppercase or use "leet", "txt" or "chatroom" speak

Calm down. We aren't that hard of reading...

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

I get the link displayed in the status bar. No problem here on FireFox.

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

I must have missed something. Where is the description of the problem you are having? Is it hidden somewhere? Or are we supposed to read and understand 300 lines of code with no idea what problem we are looking for?

I have better things to do.

Where's my TV remote...?

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