Grn Xtrm 84 Posting Pro in Training

OKOK,, fine, you made your point. i am going to the black market to get some help.....

Don't do anything illegal. I'm sure you can find a new dog talk forum to participate in. Remember, living well is the best revenge. Join the new forum and become an outstanding member. Build up your rep as the biggest dog fanatic on the internet. Then your old forum will beg to have you back. ;)

Grn Xtrm 84 Posting Pro in Training

Scroll to the bottom of the page and click the link that says Mark As Solved (or something like that)
It will be after the last post. Thanks.

Grn Xtrm 84 Posting Pro in Training

Glad to help. Please mark the thread solved if you have no further questions. Thanks.

Grn Xtrm 84 Posting Pro in Training

Try changing line 8 to:

Scanner scan = new Scanner(System.in);
EGutierrez91 commented: thanks! +0
Grn Xtrm 84 Posting Pro in Training

I believe the first figure is supposed to be 2 triangle, one on top of the other. The second figure is supposed to be a diamond. This is the output he wants. The format got messed up because he didn't enclose the figures in code tags.

Grn Xtrm 84 Posting Pro in Training

Remove the "\n" from line 13. It worked for me this way.
\n sends output to the next line. When you are scanning input, you don't need to go to a new line.

By the way, next time you have a C question dont post it in the C++ forum. We have a forum dedicated to C. Thanks.

Grn Xtrm 84 Posting Pro in Training

Why did you post a question as a code snippet?
If you want help with this problem, post your current code in a new thread on the c++ forum and ask specific questions.
Make sure you post your question as a new thread.

Grn Xtrm 84 Posting Pro in Training

No semicolons after method names in the definition.

// ------------------------------------------------------------
// Another constructor - with two parameters - if you know the name and the age of a Person
// ------------------------------------------------------------
Person(String newName, int newAge, String newNationality);
{
name = newName;
age = newAge;
nationality = newNationality;
}

Look at line 4.
Just a few small errors. It looks like you know what your doing for the most part. Good work.
By the way, to use code tags use code=java, not java=code. Thanks :)

Grn Xtrm 84 Posting Pro in Training

Functions generally are declared as prototypes above the main().

double fv(double);
int main()
{

The function definition (i.e. text of the function) must be written outside of the main(). Finally, in your case the function should be called within main().

Grn Xtrm 84 Posting Pro in Training

Can you please tell us what the program is supposed to do? The code compiles fine but we won't be able to help you fix it if you don't tell us what the code is supposed to be doing. Thanks.

Grn Xtrm 84 Posting Pro in Training

Estefania, please mark the thread solved if your problem has been solved. Thanks.

Grn Xtrm 84 Posting Pro in Training

Again, not sure but try changing line 20 to else if, instead of just if.

Grn Xtrm 84 Posting Pro in Training

First I would try to create a method in your second code that is essentially a copy of the main method in the first code. Try making it a void function with no parameters. Then just call it in the main method of the second code. I'm not positive that this will work flawlessly but I think it is worth a shot. Good luck.

Grn Xtrm 84 Posting Pro in Training

Just repost the code using the code tags this time.

Grn Xtrm 84 Posting Pro in Training

You can make a menu where the user picks a an operation. Depending on the choice a function will be called to implement that specific operation.
Functions can include add, subtract, multiply, divide, powers of exponents, square root, etc.
You can ask the user how many numbers they want to manipulate (i.e. add, subtract.........). Then perhaps, store the numbers in an array and perform the specific operation.
I'm sure someone else can weigh in with a better abd more efficient method.

Grn Xtrm 84 Posting Pro in Training

Actually there is only 1 index, which is 0 in char A[1];
A[0] = 'a'; //ok
A[1] = 'b'; //bug

Wow, yes you are right. I mistyped there. Thanks for the correction.
With only one element there is only one index, which is 0.

Grn Xtrm 84 Posting Pro in Training

Do not put a semi-colon at the end of your while statement.

Wow how did I miss that one. ;)

Grn Xtrm 84 Posting Pro in Training

Like I said in the other thread, post your code and the errors being reported by the compiler.

Grn Xtrm 84 Posting Pro in Training

You should really proofread your code before posting.
Look at the print statement for your defalt case.

System.out.print

Shouldn't be capital Out

Grn Xtrm 84 Posting Pro in Training

I don't know you tell me. :)
But seriously, tell me the error being reported by the compiler.
Also post your updated code.

Grn Xtrm 84 Posting Pro in Training

I'm pretty sure switch must be lowercase 's'.
Also no semicolon after the parentheses after switch.
And on first glance it doesnt look like you closed the statement in the appropriate place. You should close your switch after the text of the default case.
One last thing, please use code tags to make the code more readable.

Grn Xtrm 84 Posting Pro in Training

Hi, I can see you are new to the community. You need to show effort by supplying the code you have already tried. Also you need to ask specific questions about the code. We can't help you with such a vague question.
So post your code and questions so we can help you out. Thanks. :)

Grn Xtrm 84 Posting Pro in Training

How about you ask specific questions about your assignment and please write in normal english. I can barely read your post ;)

Grn Xtrm 84 Posting Pro in Training

Array indexes start at 0.
char arrURI[1]; -- creates an array of size one
-- so there are two indexes 0 and 1
char data[0]; -- creates an initially empty array
Hope that is what you were looking for.

Grn Xtrm 84 Posting Pro in Training

Looking over your code the part that stands out is

makeChange.pennies = static_cast<int>(remainingMoney * 100);

You dont have a remainingMoney = ....... like in all the other change denominations. Try adding that to the code.

Grn Xtrm 84 Posting Pro in Training

Where is the function definition in your code? That second snippet should be included in the first as a function definition and I'm not seeing it there. Also you didnt close your function in that second snippet.

Grn Xtrm 84 Posting Pro in Training

Can you post your revised code please?

Grn Xtrm 84 Posting Pro in Training

In the makeChange function remove the data type 'float' from the remainingMoney variable you only need to put float in front of the variable once.

Grn Xtrm 84 Posting Pro in Training

I don't know if this will resolve the problem but you need to put your calendar function outside of the main function. Put your function after the terminating } of the main(). See if that helps.
Also you have two braces after if/else in other spots two. If those are unnecessary, you should delete them as well.

Grn Xtrm 84 Posting Pro in Training

Maybe I am misunderstanding the point of the program, but your while is set up with NOT EQUALs. So, while the grade is not equal to A,B,C..... you will enter grades in the do part. If you enter A,B,C... then you won't be fulfilling the condition in the while and you won't re-enter the do part. Not sure if that's what your looking for, but I hope it helps.

Grn Xtrm 84 Posting Pro in Training

Have the sender convert his/her copy of the database to be compatable with 2003. When you save an Access databse using 2007 you can choose to save it as a 2003 db. This way a db created in 2007 can be opened with 2003.

Grn Xtrm 84 Posting Pro in Training

What does k refer to in your program. Where is the number held by the variable k used in the program. The formula only needs 3 variables, so I'm a bit confused where k is coming from. Can you please clarify this?
By the way please use code tags when supplying code on this site. Thanks.

Grn Xtrm 84 Posting Pro in Training

This is the c++ forum, do some work and then post your specific questions in the appropriate forum.

Grn Xtrm 84 Posting Pro in Training

So he can send you a million dollars, why else?

Oh, well in that case check my profile :)

Grn Xtrm 84 Posting Pro in Training

Do you need two braces after your if statement here

if (x==1)
{  
   {

(Lines 54 - 56)

Grn Xtrm 84 Posting Pro in Training

I think this code runs best

#include <stdio.h>
int main()
    {
    int i, j, k, rows;
    char wait;
    printf("Specify the number of rows (between 1-9) in the dimond: ");
    scanf ("%d",&rows);
    scanf("%c", &wait);
    printf("\n");
  
    for(i=1; i<=rows-2; i++)
        {
        for(j=1; j<=rows-i; j++)
        printf("%c",' ');
        for(k=1; k<=2 * i-1; k++)
        printf("%c",'*');
        printf("\n");
        }
        int l,m,n;
        for (n = rows-3; n > 0;n--)
        {
        for (l = 1; l <= rows- n; l++)
        printf("%c",' ');
        for (m = 1; m<= 2 * n- 1; m++)
        printf("%c",'*');
        printf("\n");
        }
        printf("Enter any key to end");
        scanf("%c", &wait);
         return(0);
       }

Thanks to SVR for the help.

Grn Xtrm 84 Posting Pro in Training

You have over 200 posts and should have known the rules and that posts are not normally deleted unless they violate DaniWeb rules.

You are right, sorry to have wasted your time. I will be more careful when posting in the future. Thanks again.

~s.o.s~ commented: For taking this all in good spirit... +0
Grn Xtrm 84 Posting Pro in Training

helllo may i know your name:)

Ummm.... Why....???? :S

Grn Xtrm 84 Posting Pro in Training

I did say you can replace the code after next week. But ok, rules are rules. Thanks for your time.

Grn Xtrm 84 Posting Pro in Training
int a=17;
            int b=24;
            int t;
t == a;
a == b;
b == t;

It's just like that?

Well that's the right idea, but you only need to use one = sign.
You are assigning (=) not comparing (==).
Good work!

Grn Xtrm 84 Posting Pro in Training

You can convert access databases down. That is if you have a 2007 db you can convert it to a 2003. When you save an acess db you can choose what version you want to save it as. So if you create a database using Access 2007 and want to also use it on Access 2003, you can save the file as a 2003 db. This way you can use it on both versions of Access, and even lower if anyone still has those ;)

Grn Xtrm 84 Posting Pro in Training

Alright, you've suffered enough. I'll try to help you out.
To swap you need to three int values.
Let a= 1st number
Let b = 2nd number
Let t = temp holder
To swap you need to set t equal to the first number (a)
then set the first number equal to the second (b)
Finally set the second number equal to the temp value.
This way a becomes b AND b becomes a.

Grn Xtrm 84 Posting Pro in Training

The thread sounds awfully familiar...

Grn Xtrm 84 Posting Pro in Training

Youll have to wait and see what the others say (i dont have powers over the c++ board)

It's actually in the C forum, but I will wait patiently for other responses. Thanks.

Grn Xtrm 84 Posting Pro in Training

LOL. This code is half C and half C++. Maybe call it "C squared ++" ;)

Grn Xtrm 84 Posting Pro in Training

Probably they will say no because thats what we have said in the past.

Is there any way you can please make an exception, I'm fine with the code being resupplied after next week. The code was pretty much all mine, I just got a few pointers from one other member.
Thanks again.

Grn Xtrm 84 Posting Pro in Training

Hello, as the title suggests I want to remove the code I supplied in posts made in a thread I started in the C forum. The reason I want to do this is because the program I wrote is for an assignment due next week. I know other students in my class use google to search for code to use on assignments, so when they search for this program they will be taken directly to my program. I dont want any of the other students to copy my code. It wont look good if the whole class turns in the same exact program ;) .
So is it possible for one of the mods or Dani to remove my code from the thread. You can replace in two weeks if you want. If it is possible, I will mark the thread solved so no one tries to answer a thread with no code ;) .
Here is the thread I want snipped.
http://www.daniweb.com/forums/thread228632.html
Thanks. :)

Grn Xtrm 84 Posting Pro in Training

Thanks for the suggestion. However, I'm having a bit of trouble gettin the design I want. Here is what I get:
|_| |_| |_|*|_
|_| |_|*|_|*|_|*|_
|_|*|_|*|_|*|_|*|_|*|_
|_| |_|*|_|*|_|*|_
|_| |_| |_|*|_
Here is the code I'm using:

for(i=1; i<=rows; i++)
        {
             /*top half horizontal*/
             for(j=1; j<=rows-i; j++)
             /* prints spaces before stars */
             {board[i][j]=' ';
             printf("|_|%c", board[i][j]);}

             /*top half vertical*/
             for(k=1; k<=2*i-1; k++)
            { board[j][k]='*';
             printf("|_|%c", board[j][k]);}
             printf("|_\n");
        }
        int l,m,n;
    for (n = rows-1; n > 0;n--)
        {
            /* bottom half horizontal*/
            for (l = 1; l <= rows- n; l++)
            {
                board[n][l]=' ';
             printf("|_|%c", board[n][l]);}
            /* bottom half vertical*/
            for (m = 1; m<= 2 * n- 1; m++)
            {board[l][m]='*';
             printf("|_|%c", board[l][m]);}
            printf("|_\n");
        }
        printf("\n");
        printf("Enter any key to end");

Any ideas to get the output from my last post. Thanks.

Grn Xtrm 84 Posting Pro in Training

Thanks SVR. I didn't exactly use your simplified solution but I was able to resolve my problem by filling and printing the array. Thanks for taking the time to help me.
I do have another question that I can use some help with.
I want to print the diamond pattern but have each star encased in a box.
|_|_|_|*|_|_|_|
|_|_|*|*|*|_|_|
|_|*|*|*|*|*|_|
|_|_|*|*|*|_|_|
|_|_|_|*|_|_|_|
Here is the code I'm using:

#include <stdio.h>
#define MAX 9
int main()
    {
    char board [MAX][MAX];
    int i, j, k, rows;
    char wait;
    printf("Specify the number of rows (between 1-9) in the diamond: ");
    scanf ("%d",&rows);
    scanf("%c", &wait);
    printf("\n");
    
    if(rows == 9)
    rows=rows-4;
    else if(rows == 7)
    rows=rows-3;
    else if(rows == 5)
    rows=rows-2;
    else if(rows == 3)
    rows=rows-1;
    else if(rows == 1)
    rows=rows;
    else
    {
        printf("Invalid input\n");
        rows=0;
    }
    
    for(i=1; i<=rows; i++)
        {
             /*top half horizontal*/
             for(j=1; j<=rows-i; j++)
             /* prints spaces before stars */
             {board[i][j]=' ';
             printf("%c", board[i][j]);}

             /*top half vertical*/
             for(k=1; k<=2*i-1; k++)
            { board[j][k]='*';
             printf("%c", board[j][k]);}
             printf("\n");
        }
        int l,m,n;
    for (n = rows-1; n > 0;n--)
        {
            /* bottom half horizontal*/
            for (l = 1; l <= rows- n; l++)
            {
                board[n][l]=' ';
             printf("%c", board[n][l]);}
            /* bottom half vertical*/
            for (m = 1; m<= 2 * n- 1; m++)
            {board[l][m]='*';
             printf("%c", board[l][m]);}
            printf("\n");
        }
        printf("\n");
        printf("Enter any key to end");
        scanf("%c", &wait);
        return(0);
        
        }

Any suggestion would be appreciated. Thanks.

Grn Xtrm 84 Posting Pro in Training

The code given to you by firstPerson makes the user input a new number while the current value (input of the variable) is less than zero. This repeats until the user enters a valid number.