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

you need the prototype for both functions. You also have to write the functions.

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

Does it only seem to affect posts made semi-recently or are you finding that posts made a couple of months ago are also suddenly out of order?

Its a random thing and does not happen to me very often-- The last time I saw it was when Narue and I posted almost at the same time.

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

functions must be declared before they can be called. Your previous post contains the function prototype -- why did you delete it?

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

Then I suppose the changes I've posted so far will be ok. You have yet to prototype printCheck(). The code you have at lines 25-35 will have to be moved into that function. That simplifys the main() like this:

int _tmain(int argc, _TCHAR* argv[])
{    
    string date;
    string firstName;
    string lastName;
    double amount;
    enterData(date, firstName, lastName, amount);
    printData(date, firstName, lastName, amount);
    return 0;
}

Now, I'm not going to write the rest of the program for you. You can do that and post code with question(s).

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

Ok, then the code at lines 15-22 should be inside that function and main() should only call it once. Did your instructions say exactly how that function should be prototyped ? Because I think you should pass those parameters by reference so that it can change the values of the variables declared in main(), something like below.

void enterData(string& date, string& firstName, string& lastName, double& amount);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You start by accepting an entry-level position, which will probably consist of boring work like maintaining existing programs. As jtwending said most college graduages with bachelors and even masters degrees don't really know programming. Yes, they may know the language(s) but that is not the same as programming. The difference between someone with a degree and someone without a degree is that the person with the degree will probably advance in his/her career faster and be offered more opportunities than the person without a degree. So the degree is not totally useless.

And whether your degree path requires lots of math or not depends on what type of programming you like to do. Graphics, scientists, medical, economists, and many other fields need programmers with quite a bit of math. General business type programs require only college algebra and maybe some trig.

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

You SHOULD program to ask for those things. How else is the program supposed to know it. And the date should also be a string and not an integer so that you can enter something like "30 Sep 2007"

The parameters on line 17, 19 and 21 do not match the parameters to the function on line 5, so your compiler will complain about that. Since you already coded cin to get the information I see no useful purpose for enterData().

Line 29: you need to change it so that it prints the names that you entered previously. Something like this will do it:

cout << "Pay to the order of: ";
cout << firstName << " " <<  lastName;
cout << "      $" << amount << endl;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>since it is an online class it is hard to get help
Naw -- there's lots of help here at DaniWeb :)

Appears you have declared variables firstName and lastName incorrectly -- should be declared as std::string instead of char. The way you have it those variables can only hold one character, which I doubt you intended to do. You'll need to change lines 4 and 12, something like this:

#include <string>

<snip>

void enterData(int date, string firstName, string lastName, double amount);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

[IMG]http://img170.imageshack.us/img170/8015/lgemat07ma5.jpg[/IMG]

Yuuk! what is it? Looks like something I threw up the last time I was sick.

~s.o.s~ commented: A mean comment. Not expected from you *at least*... +21
Dave Sinkula commented: Tasteless and out of character. -2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you replace ShellExecute() with CreateProcess() the caller process will get a handle and can then call WaitSigngleObject() to wait until the spawned process terminates.

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

I don't know if it is or isn't because his public profile doesn't say where he is. But I have seen that behavior several times before, where non-English speakers are better at the English written language than many native English speakers. ~S~O~S is a good example. His writing is outstanding.

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

If you'd prefer a sample of my writing with better (not necessarily perfect, simply better) examples of proper English grammar, please feel free to look over pretty much every other post I have made in the forums. If you find any that do not fit a proper English-language grammatical mold, please bring them to my attention, and I will do my best to learn from the errors within so as not to perpetuate them in my future written statements.

Already did that before I posted just to see if you were otherwise a good at English, which I saw you seemed to be. I was hoping not to insult someone whose native language is not english. If I did anyway, my apologies.

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

what error(s) do you get?

Move declaration of numz outside that while loop, probably just under the declaration of the other integers.

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

It only counts the number of vowls in the last line read. Move the closing brace at line 27 down to line 39 so that the program will count the number of vowles in every line. Also in line 34 is it not necessary to use isalpha because checking for each vowel letter will do that as well.

>>Our professor wanted us to use a switch/case statement
Then replace that if statement with a switch statement

switch (ch)
{
    case 'a': case 'e': case 'i': case 'o': case 'u':
          // do something
          break;
    default:
         // not a vowel
         break;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yep. I think AD had figured that out JB :)

Yes, I learned how to count to 5 a couple years ago. Pretty soon I'll have to learn how to count to 6. :)

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

>> It's not generating more than 60 numbers
That's because 207-146-1 = 60 (see line 34)

What's the purpose of the loop at lines 43-48 ? All it does is print several line feeds and you can do that without a loop.

>>It's not being printed in 5 columns.
probably because of the endl at the end of line 38. Looks like you need to move lines 45 and 46 up to line 39, then delete lines 43-48.

>> Is my bubble sort algorithm ok
No. What is this supposed to be sorting? both count and numbers are just simple integers. Only arrays can be sorted. If you want the numbers to be displayed in sorted order then you will have to make numbers and array of at least 60 integers.

Line 50, you are using the wrong comparison operator -- replace > with <.

for (i=0;i < count-1;i++)

Same problem at line 51.

You should also be more liberal with braces. Lines 42-49 should be coded like this:

for (i=0;i<count-1;i++)
{
    for (j=i+1;j<count; j++)
    {
           if (count>numbers)
                swap (count,numbers);
    }
}

Note that you do NOT want the braces at lines 49 and 54 of the code you posted.

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

post new code.

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

look at line 43 -- the condition is wrong because i is initialized to 0, so it will never be greater than 146. And why do you want that loop to print the same value for numbers so many times? numbers never changes value within that loop.

[edit]line 34 is screwy too -- since i is initialized to 147 there is no need to test that it is greater than 146. Just simplify to this:

for (i=147; i < 207; i++)
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sorry, me no draw well. Me no have piggy to show.

and you no write english well either.

Sulley's Boo commented: that's called 'cute eng.' you meanie <_< +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

^ Morning :)

^ Afternoon :)

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

silk soymilk and dry cerial. yummmmy

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

line 38 uses k as the loop counter, but lines 40 and 42 use a different variable. Either correct lines 40 and 42, or change line 38 to re-use i integer (preferred). Programs should attempt to reuse variables, especially one-letter loop counters, whenever possible so that the program has fewer variables and makes it easier to understand.

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

That appears to be only part of your program because main() looks incomplete.

>>That's true, it wont work.
It will work if you use the correct flags. Add std::ate as the second argument to the open function. Read this for more information

>>Only one time write values
No idea because the code you posted does not write anything to the file in main() nor does main() ever call dataExtract().

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

>>i need to know how is that possible....
Get out a pencil & paper then step through the program youself and you will see how it works. The first time hanoi is called from main() the value of N is 3. Since N is not 0 the test on line 5 will fail and line 9 is executed. It subtracts 1 form N and calls hanoi again with the value of 4. This repeats itself until 0 is reached at which time line 7, the return, is executed. Then line 10 is executed with N = 1. Now you can trace through that program with pencil & paper writing down the values of N at each step of the program.

#include<stdio.h>

void hanoi(int n,char from,char aux,char to) 
{
    if (n==0)
    {
        return;
    }
    hanoi(n-1,from,to,aux);
    printf("\nMove disk %d from %c to %c",n,from,to);
    hanoi(n-1,aux,from,to);
}

int main(void) {
   hanoi(3,'a','b','c');
   getchar();
   return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In history, George W. Bush may take first place amongst US presidents, if not all world leaders, as the leader with the best sense of humor. If you think the leader of your country is any better, give us an example.

Here are some of GWB's better examples that bring a smile to anyone's face:
All of this is orignal material by GW himself!

That doesn't reflect a sense of humor but rather a lack of real intelligence. He was completly serious when he uttered those words.

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

It uses recursion -- if you don't know what recursion is then you won't understand how the program works. Other than that, it is a poorly written program.

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

Then use win32 api functions or MFC. You will probably want to read this tutorial. Chapter 13 covers basic drawing functions.

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

what compiler and what os? Never heard of a horizontal chart. Looks something like this:

4 |
3 |
2 |
1 |
0 __________________________________
   1   2   3   4   5   6   7

You could use something called Maple

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

These quizzes are always supposed to be just for fun. .

Which is why I answered the questions the way I did -- not because I believe all that bull but I wanted to see the final results. Bush President for Life!:D

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

don't check for integer length but check to make sure the program doesn't read in more strings than the array can hold, something like this

int count = 0;
while(count < 120 && getline(inFile,name))
{
    names[count] = name;
    ++count;
}

The above loop when either of the two conditions exist: either the value of count becomes 120 or when end-of-file is reached. After that loop terminates then you can code a bubble sort or some other sorting algorithm to sort the strings.

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

Suggestion: don't attempt to sort the array on every iteration of the input loop. Read all the strings and sort only one time after the loop terminates.

>>int count=120;
initialize that variable to 0 instead of the max array size. Then insert the new string into the array at count element and increment it in anticipation for another string.

int count = 0;
while(getline(inFile,name))
{
    names[count] = name;
    ++count;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your score is 10 on a scale of 1 to 10. You are a True Believer in President Bush. Your loyalty and devotion to him is matched only by your desire to see his liberal detractors locked away and declared enemy combatants. Given the chance, you'd gladly vote Bush a third term, and if America were so blessed, you'd be perfectly content if Bush were president for life.

All sing praises to His Hindass GW Bush.

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

Yes, I use that function frequently and it works well for me.

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

And after writing the output to a file call system() (or some other similar os-specific function) to launch Notepad, for example

system("Notepad myfile.txt");
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> i don't know is it correct
Compile and test it and find out if its correct or not.


1. There is no need for the second and third parameters to that function and possibly not even the first parameter. You can make all those parameters local to that function because the calling function will not be able to see them.

2. Delete the return 0 last line because void functions to not return anything.

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

use your compiler's debugger and step through the code. At the line where you get the assert error check variable values.

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

since you have the source code you can change it however you want. But ini files themselves are not usually UNICODE so you might have to add a little code to convert from wchar_t* to char*, assuming that is even possible, which it might not be with some languages.

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

The second problem I've seen occasionally too. Never attempted to mark forums as read so never experienced the first problem.

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

yes, as I said before just output the data to a text file then open it with Notepad and print it manually. Simple solution and your program desn't have to worry about printers. Same as my previous example but instead of the file name "LPT1:" use some other name such as "myfile.txt".

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

Just open a stream to "LPT1:" and send the data to it. Try this program and see if it comes out on your printer.

#include <fstream>
using namespace std;

int main()
{
    fstream out("LPT1:");
    if( out.is_open())
    {
        out << "Hello World\n";
    }
    return 0;
}

[edit]The program hangs up on the return statement on my computer -- running Vista Home Premium.[/edit]

[edit]More info here and more here [/edit]

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

What do you mean "write it to a file"?

Like use fstream object and output the text to a file. Not all that difficult. If you don't know how to do that then I don't think you can complete the project on time.

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

I think you can ignore the last letter thing -- just sort according to normal descending sort rules and the last letter will fall in line correctly.

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

Does the id array sort properly ? If not then you need to rethink the algorithm. Get that array sorted correctly first then you can add the code to swap the other array at the same time the id array elements are swapped. If you need a selection sort algorithm just use google and you will find lots of them.

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

I don't see where you declared the class variables.
>>line 130
>>dollars = dollars * ( 10 / 100 ) ;

What is that supposed to do ? That is still integer math which will result in 0. 10 is an integer and 100 another integer, Code it like this and it will work

dollars *= 0.1

or 
dollars /= 10.0;

Of course dollars must be declared as either float or double if you want to see the fractional parts.

what is line 175 supposed to do? If you want dollarSign why not just hardcode it? People don't normally require the dollar sign as part of the input, only the digits and possibly negative sign.

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

>>different acount types
like checking, savings, loans, mortgages, certificates, etc ?

>>how to connect the different account types to the user
You have that backwards -- connect users to account types. Each user has one or more account types, for example I have a checking account and a savings account. Then given an account type you can find all the users. This is a simple and frequently used type problem in real-life programming, normally database programming, and useful in thousands of situations.

For a simple program like you need to write I think you can do it with linked lists instead of databases, unless of course you are in a database class. Create a linked list for each account type that you want. Then a structure or c++ class that contains all the information for one user that you can attached to that linked list.

>>How to do the giving Loan part
Ask how much money to loan, allocate memory for a new node to be inserted into the linked list mentioned above.

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

you can write your own functions to replace them. ini configuration files are nothing more than simple text files that are in the format

[tag name]
<field> = <value>

So the program you write just searches for the tag name then the field and value.

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

post curent code because I can't see your monitor from where I am sitting.

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

>>which i hear is impossible
No its not -- there are lots of programs that do it. Why not just write it to a file then use word if you want to print it ?

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

Yes, but its more complex than you can handle right now. Just concentrate on writing the output to a simple text file.

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

>>I'd really like to know the difference between them and how it would affect my future
Furure employers could care less which you choose, so pick the one YOU like best and the one that will give you the best grade(s). As for your other questions you have to talk to your school consolers.