zeroliken 79 Nearly a Posting Virtuoso

neither scanf() nor getchar() will "see"
any input from the 'ESC' key. It doesn't generate a 'character'
from the perspective of C's i/o library.

zeroliken 79 Nearly a Posting Virtuoso

if(x=0&&y==0)

In line 12 use == in x to check if the values are the same

@v3ga
don't do the OP's work for him it's not your homework

zeroliken 79 Nearly a Posting Virtuoso

Post your current code so we can see what you've done so far

zeroliken 79 Nearly a Posting Virtuoso

The code you posted is in c++ format and not in standard c format

now for assigning...

if (*k==1) *k==0;
else *k==0;

== is used to check if the values are equal
= is used to assign a value to a variable

zeroliken 79 Nearly a Posting Virtuoso

We can only help you if you help yourself post your code if you have problems with them

Ancient Dragon commented: Absolutely :) +17
zeroliken 79 Nearly a Posting Virtuoso
if(moreseats == 88)
{ 
    System.out.println("You entered 88, no more seats.");
}

just using a println will not stop operations that should come after it try using a loop then use a break when 88 is entered

the problem with the arrays lies within the loops try to trace your code

actually.. most of your problems will come from the loops you've made maybe rewrite your code and trace each step

zeroliken 79 Nearly a Posting Virtuoso

The second thing I'm trying to do is have it total the numbers in the array, which are basically {99, 88, 77, 66, 55, 44, 33, 22, 11, 0},

use a loop that will add the value of the current array index

zeroliken 79 Nearly a Posting Virtuoso

For a getter setter method example check this link

zeroliken 79 Nearly a Posting Virtuoso

Can you go on from here or do you still have questions?

zeroliken 79 Nearly a Posting Virtuoso

A constructor that takes a String and double to initialize the instance variables

Now constructors as I have learned are simple mechanisms like this:

public Box(int x, int y, int z) //Triple Argument Constructor
    {
        length = x;
        width = y;
        height = z;
        }

From what I have here from a past assignment it simply assigns values based on input or a set value and then applies them to say System.out.println in any way I might want like adding. I'm confused as to how to apply this knowledge to what I have in italics above.

Can't the link I provided help you?

Strings just store whatever it is that you may put in them correct?

yes

zeroliken 79 Nearly a Posting Virtuoso

yes, all it is supposed to do it print out the list. I figured that was the easiest and best way but if I set the private double to a set value how can I use a string and the double together? It is a simple concept I am having problems with.

What do you mean by use a string and double together? combine them? print them in same line?

zeroliken 79 Nearly a Posting Virtuoso

If the price is fixed you could have just initialized it already e.g.

private double coffee = 1.00;

Now I don't see a method name for the following.. Is this supposed to print the output

{
System.out.println("Item Name	 Price");
System.out.println("Coffee	 $1.00");
System.out.println("Water	 $2.00");
System.out.println("Milk	 $1.50");
System.out.println("Bagel	 $1.25");
System.out.println("Donut	 $0.75");	
}

Now I could tell you the right way to make your class but learning on your own will be more rewarding so I'll post this link on how java classes are constructed

AAChaoshand commented: will not do the work but will help the person, I like this method as it helps me understand the material. +0
zeroliken 79 Nearly a Posting Virtuoso

The advice by Warburg is a valuable hint, but the WIN32 API funcion ReadConsoleInput waits for a keypress or a mouseclick. It must be supplemented with a wait function. The following function returns zero when nothing was pressed and ASCII code when something "ASCII" was pressed. I hope that this solution really works (even in "console" applications), but nothing is 100% ...

int keytest( void )
{
    CHAR ch;
    DWORD dw;
    HANDLE keyboard;
    INPUT_RECORD input;

    keyboard = GetStdHandle(STD_INPUT_HANDLE);

    dw = WaitForSingleObject( keyboard, 0 );
    if( dw != WAIT_OBJECT_0 )
      return 0;
    dw = 0;
    // Read an input record.
    ReadConsoleInput(keyboard, &input, 1, &dw);

    ch = 0;
    // Process a key down input event.
    if( !(     input.EventType == KEY_EVENT
            && input.Event.KeyEvent.bKeyDown )  )
    {
        return 0;
    }


    // Retrieve the character that was pressed.
    ch = input.Event.KeyEvent.uChar.AsciiChar;

    // Function keys filtration
    if( input.Event.KeyEvent.dwControlKeyState &
        ( LEFT_ALT_PRESSED | LEFT_CTRL_PRESSED | RIGHT_ALT_PRESSED | 
          RIGHT_CTRL_PRESSED )
      )
      return 0;

    // if( ch == 13 )
    //  ...;  // enter pressed

    return ch;
}

you do realize your replying to a post from 2005

zeroliken 79 Nearly a Posting Virtuoso
for( int j = 0; j < 100; j++);

in line 4 there should be no semicolon ; there

zeroliken 79 Nearly a Posting Virtuoso
for ( int = 10; i > 0; i--)

missing i in the declaration

Guys I don't know the output of the following loop please help me out

I think you should study how loops work before asking questions like these.. the codes you posted are very basic it should be easy enough for you alone

Even a book can show examples like these

for ( int i = 10; i > 0; i--)
    {
    system.out.println ( i*2);
    }

the output is the current iterative value multiplied to 2

while( a < 20 )
    { a += 3; System.out.println( a ); }

"if" the value of a is originally 0 the last output should be 18

zeroliken 79 Nearly a Posting Virtuoso

Huh? This is the C forum...

This thread was originally posted in the Java forum and was moved here

zeroliken 79 Nearly a Posting Virtuoso

There are tons of exercises on the web if you just search right.. try google search

zeroliken 79 Nearly a Posting Virtuoso

So....

is there a specific error you want to tell?
are you asking us for suggestions or instructions?
Are you unsure of what to do next?
or maybe the code doesn't give the correct output?

zeroliken 79 Nearly a Posting Virtuoso

read here for more info
timer classes

zeroliken 79 Nearly a Posting Virtuoso

the reason the else statement is never reached is because all the possible outcomes can already be found in the if and if else statement

Scratch that I mean if and else if statements

zeroliken 79 Nearly a Posting Virtuoso

First, We don't code for you... we can only help provided you give your code that you need help with

Second, if just your just asking for suggestions then you can use arrays and an if statement to compare the letters to their corresponding number..then do the operations required to match the whole roman numeral counterpart...but that's where it gets complicated

zeroliken 79 Nearly a Posting Virtuoso

First of all, I don't even know what do you mean by "format the code properly". I used tabs, enters and spaces as much as I can see. What is so improper about it? I could have answered if you had asked a question about the code which is precisely what you didn't do. I don't think I'm above rules but I'm not really aware of the fact that I have broken any. I asked you to create 2 .txt files of 6 numbers, which isn't exactly the twelve tasks of Hercules, because that is what I am supposed to do. And by the way, don't you think that your answers were a bit too generic, effortless and arrogant?

If you checked your code that you posted(meaning as seen in this forum) you can see that there's not much tabs, enters and spaces as you stated and it's better to use comments on every line if your code is like that

Anyway..while "trying" to understand your code(just a single glance) I found this

printf("%8.2lf %8.2lf\n",rez,reserror);}

in line 47 rez is not defined... shoudn't it be res?

P.S. Like WaitP stated we don't have the time to make the files required to run this program... this is as much help as you can get if can't narrow down the problem.. simply tracing another persons code is very,very much time consuming while the only reward we can get from it is your satisfaction.. Not much motivation is there?

zeroliken 79 Nearly a Posting Virtuoso

3. The else condition is never reached.

the reason the else statement is never reached is because all the possible outcomes can already be found in the if and if else statement

zeroliken 79 Nearly a Posting Virtuoso

Can someone please help me?!?!

In what way can we help you

Is there an error?

I notice in your code that you don't have a constructor function in the code you posted above

zeroliken 79 Nearly a Posting Virtuoso

is there any simple code for geometric mean...?

your replying to an old thread...start your own

zeroliken 79 Nearly a Posting Virtuoso

are these included in your code?

import java.io.*;
import java.util.*;

you made an obvious mistake here use // for comments

System.out.println();II Return The Lords of the Rings to the first library

include methods in your class

public static class Book {
public Book() {
}
}

addBook(and most of the others) method should be in the Book class

firstLibrary.addBook(new Book("The Da Vinci Code")); 
firstLibrary.addBook(new Book("Le Petit Prince")); 
firstLibrary.addBook(new Book("A Tale of Two Cities")); 
firstLibrary.addBook(new Book("The Lord of the Rings"));

Stultuske already corrected your errors before:

well, basically, you're calling a lot of methods that don't exist.
also, you're trying to create instances of Book with a String param, but as far as I know, your Book class doesn't have such a constructor.

make sure you create all the methods you're using, or you'll automatically get error messages during compilation.

zeroliken 79 Nearly a Posting Virtuoso

nope, no one explained this to me before...

Isn't it your duty to learn or know something like that?

zeroliken 79 Nearly a Posting Virtuoso

So in order to understand the source code !! from where should i start ????

it depends on the code and the programming language used

zeroliken 79 Nearly a Posting Virtuoso

line 2 will work better without the "int".

your right....Edited
I only want to show that you'd use an integer

zeroliken 79 Nearly a Posting Virtuoso

On another note, any ideas on how i should set up the point system? One point for winning minus points for breaking the rule.. That's pretty much the only thing I don't have SOME idea on how to approach

add score to whoever wins

boolean won;
if(won)score++;

it's up to you if you want to use a boolean or not to declare the winner

zeroliken 79 Nearly a Posting Virtuoso

Hey, how do you compare two arrays? It's something like .equals right? I need to check who wins the rock paper scissors battle by comparing the arrays.

Again use a loop to compare the indexes then check

if(array[i]==array2[i]){}
zeroliken 79 Nearly a Posting Virtuoso

I can't guess the location of the errors in your code

post your whole code

zeroliken 79 Nearly a Posting Virtuoso

post the errors

also you have no option or statement to change the value of stay

zeroliken 79 Nearly a Posting Virtuoso

Sorry, i updated my last post I don't know if you saw it. Basically what i need it to do is not DELETE the arrays but simply move them. For instance when I put in a new value of rock and all of the four array slots are full then it should move array[3] to array[2]...ect therefore, array[0] will lose it's old value, and array[3] will receive an entirely new value.

make another loop that assigns the current arrays value and the array after it

array[i]=array[i+1];
zeroliken 79 Nearly a Posting Virtuoso

// it needs to be in a loop so that the game continues until the person tells it to stop//

use a boolean and change the value on the boolean once the user makes the choice to stop

zeroliken 79 Nearly a Posting Virtuoso

You can't exactly delete an array since its static and not dynamic
maybe just assign a new value to it...

zeroliken 79 Nearly a Posting Virtuoso

What i don't know is the loop structure i need to keep constantly updating my array [4]. I know the basic idea but i don't know the code for it.

what do you mean by update? change the content? shouldn't you just assign another value to it

zeroliken 79 Nearly a Posting Virtuoso
Compinput[y

line 129: ...your getting careless

zeroliken 79 Nearly a Posting Virtuoso

can you post your code in [ Code ] tags without the extra lines and symbols in?

Do we have to repeat?

zeroliken 79 Nearly a Posting Virtuoso

Still simple... use a loop again

int sum;
for(int i=0;i<array.length();i++){
    sum=sum+array[i];
}
NormR1 commented: Spoonfeeding - doing the OPs work -3
zeroliken 79 Nearly a Posting Virtuoso

then it's simple just use a loop that multiplies the given number after it has deducted itself by 1

zeroliken 79 Nearly a Posting Virtuoso

So....

is there a specific error you want to tell?
are you asking us for suggestions or instructions?
Are you unsure of what to do next?
or maybe the code doesn't give the correct output?

please specify

zeroliken 79 Nearly a Posting Virtuoso

Does the application involve a GUI?

zeroliken 79 Nearly a Posting Virtuoso

My question was HOW to search through an array... I wanted you to tell me so I could apply that knowledge in my game.

simple... just use a loop
pseudo:

for(int i=0;i<array.length();i++){
    if(array[i]==11){
       //do something
    }
}
zeroliken 79 Nearly a Posting Virtuoso

In what way can we help you :)

zeroliken 79 Nearly a Posting Virtuoso

Since we're already using a string function try something like this

strcpy(c, "______");
zeroliken 79 Nearly a Posting Virtuoso
c = "_____";

you cant assign it like this

zeroliken 79 Nearly a Posting Virtuoso

have you declared c as a string(array of char)?
also on which line is that error?

zeroliken 79 Nearly a Posting Virtuoso
#include<string.h>

include this library

zeroliken 79 Nearly a Posting Virtuoso

your trying to compare an integer(c) and a string(secret)