Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

All about programming (Specially c, c++, VB, Java)

klaruhin mo ng konti. ano input dyan at ano output? ang naiisip ko kasi parang ganito:

sample input:
africa
australia
siquijor

output:
2 continents (africa, australia)
2 islands (siquijor, australia)

linawin mo yung proseso. gagawa ba tayo ng listahan ng islands and continents tapos titingnan natin dun sa listahan na yun kung island or continent ba ang input ng user?

Eto po ung problem

Count the Islands


This Programming exercise requires you to read in a text file, process the contents of the file and output the results.
The file consists of 50 lines of text. Each line consists of 3 sections: First is 3 characters made up of spaces and digits that you can ignore, then 80 characters which are either a space or a + then another 2 characters. The first 3 and last 2 characters are just 1 or 2 digits line numbers padded with spaces. The important part is the 80 characters.
I.e. it will look something like this (the first line <3> etc is not part of the file).
<3><-------------------------------------------80--
--------------------------------------><2>

File starts here:
1 1
27 ++++++++ ++++ +++++++ ++++++++++++ +++ 27
28 ++++++++ ++++ +++++++ ++++++++++++ + ++++ ++++++ 28

This is a map of a game world where each location is either land or sea. Land points are +, sea are spaces. What you have to do is process the 80 x 50 map, determine how many continents there are and output how many continents there are plus a list of those continents, together with the size of each continent. The definition of a continent is one or more connected locations where each location is a +. Connected means that in a 3 x 3 grid around a +, if any of the 8 surrounding locations contains a + then the two are connected.
+
++
+

The 4 locations + are next to each other.
For example your output should look something like this:
There are 5 Continents
Continent 1 has 208 +.
Continent 2 has ...

Note - The actual number of continents may be more or less than 5-that example just shows what output might look like.

naka atach po ung map na bibilangan ng mga +
 

Attachments

  • map.txt
    4.3 KB · Views: 8
@akoan

nice problem. eto ang naiisip kong algorithm:
1. create an object with the following fields:
boolean isProcessed
boolean isLand
int continentID

2. create an 80 x 50 array of the object defined in number 1
3. for each point in the map, store it in the array with the corresponding coordinates and set isLand to true if it is a land, otherwise set it to false. set isProcessed to false
4. declare continentNum = 1
5. do this loop
Code:
while there is a land point to be processed
       pick an unprocessed point that is a land
       set its isProcessed to true
       set its continentID to continentNum
       store its neighboring lands with isProcessed == false to a vector
       while the vector is not empty
             remove an element from the vector
             set its isProcessed to true
             set its continentID to continentNum
             store its neighboring lands with isProcessed == false to the vector
       increment continentNum
 
Last edited:
mga master ? pa help namn po gumagawa ako \ngaun nang . GRADING SYTEm thesis kow po to eh ..pano kow ma coconnect ang 2 tables in one DATAGRID ? eh sa dataGRID po mi mag sosolve nang grid eh .. TABLE name ko ai Ang STUDENT record tas gusto ko ma attact young name nang student sa PRELIM na table .. pano youn ? tapos kuna ma relationship .. eh ang problema d kow lam kung ano ang pag code ?Visual basic 6.0 gamit kow . data based ko po ai ACCESS please help po mga master :(
 
mga master ? pa help namn po gumagawa ako \ngaun nang . GRADING SYTEm thesis kow po to eh ..pano kow ma coconnect ang 2 tables in one DATAGRID ? eh sa dataGRID po mi mag sosolve nang grid eh .. TABLE name ko ai Ang STUDENT record tas gusto ko ma attact young name nang student sa PRELIM na table .. pano youn ? tapos kuna ma relationship .. eh ang problema d kow lam kung ano ang pag code ?Visual basic 6.0 gamit kow . data based ko po ai ACCESS please help po mga master :(

basa ka about sa sql join statement. malamang yun ang kelangan mo. punta ka sa w3schools.com
 
hello poh...nais ko lang poh magtanong anong kaibahan ng vector at array list datatypes?
Object oriented programming poh kasi namin, nasubukan ko na ang dalawa pero parang walang pinagkaiba...tnx in advance
 
hello poh...nais ko lang poh magtanong anong kaibahan ng vector at array list datatypes?
Object oriented programming poh kasi namin, nasubukan ko na ang dalawa pero parang walang pinagkaiba...tnx in advance

hindi synchronized ang arraylist. pag multiple threads ang mag-access sa arraylist at nagmodify ng structure nya, baka magkaroon ng unexpected results.

kung may kelangan ka malaman sa isang java class, google mo lang tulad nito:

arrraylist java documentation

ang top hit nyan ay sa java documentation sa oracle
 
Last edited:
basa ka about sa sql join statement. malamang yun ang kelangan mo. punta ka sa w3schools.com




Pare na connect kuna pero hindi ako maka add nang record .. huhuhu panow to ?kc dapat my 1 match sa isang table at sa isa pang table d pwede mag add huhuhu ano mas maganda gamitin ?
 
basa ka about sa sql join statement. malamang yun ang kelangan mo. punta ka sa w3schools.com




Pare na connect kuna pero hindi ako maka add nang record .. huhuhu panow to ?kc dapat my 1 match sa isang table at sa isa pang table d pwede mag add huhuhu ano mas maganda gamitin ?

If you have a table that is constrained with foreign keys, make sure ung mga keys mo dun ay may corresponding counterpart sa kabilang table.

so example:

Table 1 with columns id, name, description primary key is ID
Table 2 with columns id, comp_code with foreign key id and comp_code
Table 3 with columns comp_code, comp_specs, comp_status with primary key comp_code.

ang nagyayari diyan Table 1 > Table 2 < Table 3

naka connect ung table 1 at table 3 sa table 2, bago ka makapaginsert sa table 2, need merong values for both table 1 and 3.
 
basa ka about sa sql join statement. malamang yun ang kelangan mo. punta ka sa w3schools.com




Pare na connect kuna pero hindi ako maka add nang record .. huhuhu panow to ?kc dapat my 1 match sa isang table at sa isa pang table d pwede mag add huhuhu ano mas maganda gamitin ?

kung dun sa pinagjoin na table ka mag-aadd, separate na insert ang gagawin para sa bawat table.

di ko rin maintindihan ibig sabihin mo dito
"kc dapat my 1 match sa isang table at sa isa pang table d pwede mag add"
 
ty po.. vernonengle...

tnxx sa idea mo po...!!!

e try ko po e code...!!!
 
ty po.. vernonengle...

tnxx sa idea mo po...!!!

e try ko po e code...!!!

tinry ko yung binigay kong algorithm. mas madali kung vector instead of array ang gagamitin. tapos may dalawa akong vector, isa para sa processed at isa para sa unprocessed. nilagyan ko rin ng x,y coordinates yung mga map points (base kung pang-ilang character sila sa line at kung pang-ilang row sila sa text). simple lang sya, mukha lang mahirap
 
bro vernon
saan po pwede maka download ng complete turbo c na folders???
BTW bro eto ang vid guide na sinunod ko with dosbox pero ang nainstall ko is C++ at di C
http://www.youtube.com/watch?v=rz4lrbNCiAE

paturo naman bro...
inunintall ko na lang rin yung dosbox at dinelete yung C++ na folder...
 
bro vernon
saan po pwede maka download ng complete turbo c na folders???
BTW bro eto ang vid guide na sinunod ko with dosbox pero ang nainstall ko is C++ at di C
http://www.youtube.com/watch?v=rz4lrbNCiAE

paturo naman bro...
inunintall ko na lang rin yung dosbox at dinelete yung C++ na folder...

pwede magcompile and run ng C files sa Turbo C++. yun na lang rin ang gamitin mo
 
help nman

create a java program using jcreator that outputs the average of three numbers. Let the values of the three numbers be 10,20 and 45
the expected output is :

number 1 = 10
number 2 = 20
number 3 = 45
average is = 25

slamat
 
import java.util.Scanner;

public class Ave{

public static void main (String args[]){

int num1=10;
int num2 = 20;
int num3 = 45;
double ave=0;

Scanner in = new Scanner(System.in);

ave = (num1+num2+num3)/3;

System.out.println("The average is: "+ave);

}
}
 
same lang po ba ang mga tinatype ron???
halimba yung #include<stdio.h> at #include<conio.h>???

C files can be run sa C++ na environment as long as tama yung header files mo

while C++ files cannot be run in a C environment.

for C you use stdio and conio but u cant use iostream (tama ba?)

for C ++ you may use stdio and conio as well as iostream
 
pa turo nmn po kung panu mg gwa ng program sa JAVA/JCreator un gumagamit ng Overwriting Methods? thanks assignments po kc namin un eh, thanks.
 
@akoan

nice problem. eto ang naiisip kong algorithm:
1. create an object with the following fields:
boolean isProcessed
boolean isLand
int continentID

2. create an 80 x 50 array of the object defined in number 1
3. for each point in the map, store it in the array with the corresponding coordinates and set isLand to true if it is a land, otherwise set it to false. set isProcessed to false
4. declare continentNum = 1
5. do this loop
Code:
while there is a land point to be processed
       pick an unprocessed point that is a land
       set its isProcessed to true
       set its continentID to continentNum
       store its neighboring lands with isProcessed == false to a vector
       while the vector is not empty
             remove an element from the vector
             set its isProcessed to true
             set its continentID to continentNum
             store its neighboring lands with isProcessed == false to the vector
       increment continentNum

idea ko.. read from a text file tapos ,display.. tapos gawa ka lang marker para sa mga areas..:)
 
Back
Top Bottom