zeroliken 79 Nearly a Posting Virtuoso
for(int i = 0; i < list1.size() - 1; i++){
        if(list1.get(i).compareTo(list2.get(i)) == 0){
            list1.remove(list2.get(i));
        }
    }

once an element is removed from either list their sizes will be different from the other. So you can't compare the remaining elements of a list with the others original position

You could use a nested loop to check if a value from a list is present with every element from the other

zeroliken 79 Nearly a Posting Virtuoso

But now if I put int die1 and die2 in Dice(), how can I call it or get the value in >compGame and userGame ?

declare the die1 and 2 variables in compGame and userGame then pass by reference it to the Dice function

zeroliken 79 Nearly a Posting Virtuoso

no, not in the condition but in the body

but first things first resolve all of the issues numbered by WaitP

it should look something like

while no winner
    compturn()
    check if computer wins
    userturn()
    check if user wins
end while

but before that you need to resolve the issue with srand() position, variable scope, and returning values for the program to properly work

zeroliken 79 Nearly a Posting Virtuoso

1) srand() can only be called once and expect it to work correctly. Move it to the beginning of main()

Ah I knew I was forgetting something :)

first the computer rolls, then the user..and then again computer and then user and so >on, untill there is a winner or looser.

include the functions inside the loop with after each checking the results...
then break the loop if the winner is found

and instead of a break statement change the value of the boolean to stop the loop

then again nothing's wrong in using a break ( sorry for letting my preference cloud my judgement)

zeroliken 79 Nearly a Posting Virtuoso

remove the else main(), no need for recursive call
and instead of a break statement change the value of the boolean to stop the loop

zeroliken 79 Nearly a Posting Virtuoso

as I see it it's like this

the checking starts with 0 (list indeces start with 0) so it would look like

movies [ 0 , 1 , 2 , 3 , [ 0 , [ 0 , 1 , 2 , 3 ] ] ]

where the 4th one is a list and inside it the second one is a list

so from left to right [4][1][3] should point to Eric Idle

zeroliken 79 Nearly a Posting Virtuoso

you could use a boolean and change it's value if it falls under any of the conditions found in main otherwise by the end of the loop if the value did not change then it will continue to iterate again

also at theUserGame function don't use a recursive call to check if the input is correct use a loop instead

zeroliken 79 Nearly a Posting Virtuoso

So what kind of loop should go in main() to make the program right?

any kind of loop will do, that's mostly user preference though I suppose what you meant was
" what condition is to be used for a loop? " right?

which you need to post more details for us to know when should the program end

now for the program.
after looking at the program, notice that your functions are not returning any values

zeroliken 79 Nearly a Posting Virtuoso

your not passing any actual paramater on the functions
also local variables found in the functions will only be visible to the calling function (main) if you save their values

zeroliken 79 Nearly a Posting Virtuoso

Also, why is this needed?

change = tenDollar % 10 ; // calculate the change needed

he probably wanted the remaining decimal values to use for the quarter computation but this wouldn't work since tenDollars is an integer type and he can't use the modulo operator for float type variables

myk45 commented: Agreed :) +0
zeroliken 79 Nearly a Posting Virtuoso
for (int i = 3; i < range; i++ ){
    if (num % i == 0 ){
        prime = false;
        break;
    }
}

hint: for checking if the number is prime why does the condition here start with 3?

zeroliken 79 Nearly a Posting Virtuoso

what's the content of the new window? Is it spam or ad, etc.?
this might be because IE is set as your default browser and an application is trying to connect to the internet

If it's a regular application you can tweak the settings for connecting to the internet

If your unsure and if it looks like a virus read and follow all of the intructions set here http://www.daniweb.com/hardware-and-software/microsoft-windows/viruses-spyware-and-other-nasties/threads/134865/read-me-before-posting-a-request-for-assistance
though a simple malwarebyte scan and fix from one of the steps should automatically solve this for yahif it is a virus

zeroliken 79 Nearly a Posting Virtuoso
  1. make sure the filename extension is a valid microsoft word extension e.g. .doc, .docx, etc.
  2. open the document in comatibility to previous versions of microsoft word
  3. if still no luck then the file is most likely corrupted

here's a link from a google search of possible solutions to your problem link
Hope one of em help :)

zeroliken 79 Nearly a Posting Virtuoso

Can someone help me understand what this means?

A function that takes a double pointer float and an int variable as a parameter

Especially the **scores....

It's a pointer to a pointer (research about pointers and 2D arrays), where modifying its value/s changes the value/s of the variables passed from the calling function

zeroliken 79 Nearly a Posting Virtuoso

post your code, problems, etc

zeroliken 79 Nearly a Posting Virtuoso

well for "BEST" this would be very subjective

zeroliken 79 Nearly a Posting Virtuoso

yes played it back then,
the puzzle like environment wasn't too hard to solve you just need a good reaction time

Its a really creepy...

really... hmm well creepy isn't the first word that popped in my mind while I was playing, for me It felt more of a solitary or dream like ambience throughout the game

zeroliken 79 Nearly a Posting Virtuoso

if someone puts in the wrong password it will return them to the beginning to line 13?

use a loop

zeroliken 79 Nearly a Posting Virtuoso

Could you give more details about the problem like any error messages or program output

also take note that printf function is part of the C stdio header

zeroliken 79 Nearly a Posting Virtuoso

editted my post a while back for this:

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

include stdlib header for this
then try
system("clear");
for clearing the console screen for gcc compilers

just a note, In Dev C++ I think it's system("CLS")

zeroliken 79 Nearly a Posting Virtuoso

for the player side it shouldn't be hard just ask the user which position would he like to enter by asking the row and column or something similar to that and place that on the index of the array

for the random placement use the rand() function to get random inputs you could place on the index

zeroliken 79 Nearly a Posting Virtuoso

I've edited it and it works.But Im not sure whether its correct or not

you could test it yourself by printing the array on the parent function (main) after the function call

.Is that now I can place the ship inside the grid? if yes how should I do it? please help me

should it be put randomly or does it have a pattern?

zeroliken 79 Nearly a Posting Virtuoso

is there any other way to do it as im not good in pointer.Im a very beginner.

you could declare the grid as a global variable, also I suggest you learn how to use pointers it's gonna be useful for scoping

zeroliken 79 Nearly a Posting Virtuoso

and it would save a lot of space to use strcmp from the string library instead of comparing every index

zeroliken 79 Nearly a Posting Virtuoso

Let's start with the basics then, you need to learn a few things first before you start coding
I suggest you head over over to the java tutorials and read about classes, to learn the gist of things, here's a link
http://docs.oracle.com/javase/tutorial/java/javaOO/index.html
Once you have a clear understanding we can start tackling the coding part, feel free to ask questions here if you get stuck somewhere

zeroliken 79 Nearly a Posting Virtuoso

Do you have an idea what classes and methods are and how should they work?

zeroliken 79 Nearly a Posting Virtuoso

I currently have a subject titled "Introduction to Computer Organization and Machine-Level Programming" which focuses on Assembly language on 32 bit systems with Nasm as the compiler and uses Intel style syntax.

Having studied first high level languages first like C and Java I struggled a bit with Assembly which requires a lot of instructions to perform simple tasks which only takes a few lines for high languages to perform. Despite this unlike the high level lang I get to actually view the compute's memory storage and allocation for the program which answers some of the questions I'd have during the first years of my CS course

Now for other OS, correct me if I'm wrong as I recall Windows was built using C and also in Assembly(but the latter's only minimal)

zeroliken 79 Nearly a Posting Virtuoso

@zeroklin that means for 6 numbers i need 7 loops as the inner most is for printing it ?

yes with the 7th/innermost one for printing the array

zeroliken 79 Nearly a Posting Virtuoso

-use an array of integers for the variable
-each loop has an initialize value of zero, and a condition that it only increments up to 1
-the statement inside each loop is composed of changing the leftmost or rightmost value of the array going right if following from the former or left if from the latter
-in the innermost loop print the array

here's an example using 2 digit binary

int a[2];
    for(int i = 0; i<2; i++){
        a[0] = i;
        for (int j = 0; j<2; j++ ){
            a[1] = j;
            /*prints the whole array from the innermost loop*/
            for(int k = 0; k<2; k++){
                printf("%d", a[k]);  
            }
            printf("\n");

        }
    }
I_m_rude commented: nice explaination :) +2
zeroliken 79 Nearly a Posting Virtuoso
  • /usr/include/c++/4.4
  • /usr/include/c++/4.4.5

right can't check right now, logged in on my Windows :)

zeroliken 79 Nearly a Posting Virtuoso

firstly, How to open up the algorithm header for your compiler ? means where it is ?

check the library or lib folder of your compiler and look for the file
In my Windows using cygwin I found it at C:\cygwin\lib\gcc\i686-pc-mingw32\3.4.4\include\c++

in ubuntu probably at User/Include/gcc or g++ file

then how will i do using nested loops ?

already answered from previous posts you'd use 6 loops nested inside one another

zeroliken 79 Nearly a Posting Virtuoso

for a simple approach:
As I look at the pseudocode your suppose to ask first the user the product number then the quantity.

Next
first put the switch statement inside a loop instead of a loop inside the switch case
next use a diferent variable for the product id and the counter for the switch case

you can use a variable for each product,cost
ex. case 1 uses variables quantity1,cost1,totalcost1 next case 2 uses quantity2, cost2, etc.
or
you could use an array of each variable and use the counter from the switch statement (product number) as the index
ex. quantity[counter], cost[counter], totalcost[counter]

as for the quantity of each item just multiply this to the cost to get the total cost assuming their starting values are 1 or use a loop for repeated addition

I can see that the pseudocode is already provided for this so there's probably no need to show more of the same

Here is some pseudocode/skeleton Java code for one possible solution to the program to get you
started (this shows procedural code, but an object-oriented solution would have been better, since
Java is a pure object-oriented language):

If you want we could help you too with the object oriented approach of the program too, just say so :)

zeroliken 79 Nearly a Posting Virtuoso

also tell us what kind of game, programming languages are you using, is it concole based or will it have interactive computer graphics?,etc.

zeroliken 79 Nearly a Posting Virtuoso

Not too surprised for Apple to make this move.
This is just another petty attempt to monopolize the market on mobile devices and this is another example on how low they can get.

I'm more surprised the court actually sided with Apple with this one than the whole issue of Apple sueing Samsung over the designs.
Come on.. they have the copyright on round corners on icons and necessary softwares for touch screen technology and the court actually believed this.

happygeek commented: the phrase beggars belief comes to mind, doesn't it? +11
zeroliken 79 Nearly a Posting Virtuoso

If I cant use time for comparision, how to compare if the player is undertime?

convert timein and timeout variable to either in minutes or hours (as long as it has a single value) then compare

zeroliken 79 Nearly a Posting Virtuoso

your missing the starting bracket for main, next

if(timeout<17:00)

you can't use a time format for comparison

zeroliken 79 Nearly a Posting Virtuoso

What's your question

zeroliken 79 Nearly a Posting Virtuoso

Don't forget infamy too. I think someone started a petition to have me banned earlier today. ;)

banning an admin!? wth, why would someone want to do that

zeroliken 79 Nearly a Posting Virtuoso

the loop

zeroliken 79 Nearly a Posting Virtuoso

But what is not undertandable now?

Your leaving too may details here for us to fully comprehend the problem

If I summarize everything you've said all you need to do here is just change the ones who got the border points to a satisfactory grade like everyone who gets a 0 receives a 10 instead and that's that
but I really doubt the program only does this

zeroliken 79 Nearly a Posting Virtuoso

so i took the code my doubt is here can we take pivot element randomly???? or is >there any rule for tat

choosing the pivot doesn't have too many rules cause in most cases it's found in the middle element of a list or chosen randomly but take note if it's the latter choosing the first or last element will cause a worst-case performance ( O(n^2) if I remember correctly ) for sorted/reverse-sorted data

hii decptikon if ur der please give me a task for learning quick sort

lol looks like someone's gaining fame ;)

zeroliken 79 Nearly a Posting Virtuoso

the link goes to an error page

zeroliken 79 Nearly a Posting Virtuoso

store the years in an array,
loop through the array and print out the element if it is properly divisible by 4

zeroliken 79 Nearly a Posting Virtuoso

How about reading a tutorial from the web,

In Java here's a good tutorial (though a bit deprecated) which teaches how to make platform based games like mario you can also download and edit the source code too

http://www.javacooperation.gmxhome.de/TutorialStartEng.html
this covers the basic steps from first to last and you can reread the chapters
the mario game tutorial starts at lesson 7 though it's good to read the previous lessons

zeroliken 79 Nearly a Posting Virtuoso

sigh...
from 0-100 what would be the border points?

zeroliken 79 Nearly a Posting Virtuoso

If the present number+1 not equal to the next number, the next number will start the next interval.

0 - 6, 8 - 9, 12 - 13
so this would be the correct output of your very 1st example right?

zeroliken 79 Nearly a Posting Virtuoso

answer the rest of the questions

for the border points
are they the values near the start or are they found at the end of each mark?,
if so what's the range to tell if the value of the current mark is at the border points

zeroliken 79 Nearly a Posting Virtuoso

can numbers whose next or previous values be in a set like in your first example?

Array: 0 1 2 3 4 5 6 8 9 12 13
Output:0 - 5 , 6 - 9, 12 - 13

cause this contradicts the 2nd example in your last post where 0 and 2 is not in a set
if not then shoudn't the output of your first example be like
0 - 6, 8 - 9, 12 - 13

zeroliken 79 Nearly a Posting Virtuoso

returns the index where the current element of array y is equal to x, else returns -1 if the value of x is not in the array