Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

anthony68 (Programmer)
6 Sep 07 16:44
i want to make a table with 12 var but do not know how to begin. Can you help me how my body needs
i want the output to look like this

    1  2  3  4  5  6  7  8 etc

 1  2  3  etc
 2  3  4
 3  etc
 4
 5
 6
 7
etc

then i want to find the values with combined are over 75 something like this
if var1+var2+var3>=75 then

en want the output of that procedure to look like this;

output;
var1+var6+var8>=75
var1+var5+var6>=75
var1+var4+var7>=75
var1+var8+var2>=75
var1+var7+var9>=75
feherke (Programmer)
7 Sep 07 5:55
Hi

As a first try... Your specification is not really clear, at least not to me.

CODE

program greater_than_75;
  const nr=12;
        limit=75;
  var val:array[1..nr] of Integer;
      i,j,e:Byte;
begin
  { you said nothing about the input... }
  for i:=1 to nr do for j:=1 to nr do for e:=1 to nr do
    if (i<>j) and (j<>e) and (e<>i) and (val[i]+val[j]+val[e]>=limit)
    then WriteLn(val[i],'+',val[j],'+',val[e],'>=',limit);
end.

Feherke.
http://rootshell.be/~feherke/

anthony68 (Programmer)
7 Sep 07 9:03
for the input it has to be integer from 0 to 150 thats the max and then in the table of the 12 vars  the value in the table must seach after numbers greater then 75 or eacual.
so in the output of the program on screen;
must look like this ;

Var val1, val2,val3,val4,val5,valetc,
    val1a, val2a,val3a,val4a,val5a,valetca,
    val1b, val2b,val3b,val4b,val5b,valetcb,
    val1c, val2c,val3c,val4c,val5c,valetcc: integer;

writeln (' ','70','71','72','73','74','75','etc');
writeln ('1',val1, val2,val3,val4,val5,valetc);
writeln ('2',val1a, val2a,val3a,val4a,val5a,valetca);
writeln ('3',val1b, val2b,val3b,val4b,val5b,valetcb);
writeln ('4',val1c, val2c,val3c,val4c,val5c,valetcc);


output screen look like this;

    70  71  72  73  74  75  etc

 1  71  72  73  etc
 2  72  73  74
 3  73  74  75
 5  75  76
 6
 7
etc


Then i got to find out what value in the table is grater or ecual  at 75. so something like this

program greater_than_75;
  const nr=12;
        limit=75;
  var val:array[1..etc] of Integer;
      i,j,e:Byte;
begin
  { you said nothing about the input... }
   {input must look like this;}
    
var
   r, c: Integer;
   a: array [1..12,70..82] of Integer;
 
begin
   for r := 70 to 82 do
      for c := 1 to 12 do
         Readln(a[r,c]);
end.

{ here i got to do something with the results of the readln (a[r,c]) I got to look in the values of the 2D array and take out the values that are grater or eceal as 75 }

  for r:=70 to 82 do for c:=1 to 12 do for e:=1 to ??? do
    if (r<>c) and (c<>r) and (e<>c) and (val[r]+val[c]+val[e]>=limit)
    then WriteLn(val[r],'+',val[c],'+',val[e],'>=',limit);
end.

{ its comming to gether now but i do'n understand the basic of it}

lionelhill (TechnicalUser)
7 Sep 07 9:07
At a glance, I think you can improve the for loops and cut out a lot of the if, simply by starting each for at the current value of the loop outside.

For a = 1 to limit do
begin
  for b = a to limit do
  begin
    for c = b to limit do
    begin
      if (val[a]+val[b]+val[c] > 75 then .....

The output will be different; the version above will find only one arrangement of each three variables that exceed 75, eg. var[1]+var[2]+var[3] and not also var[2]+var[1]+var[3] etc.

(there seems some ambiguity about > or >=)

If you had a big data set, you could improve the situation. For instance, you could check that the first, or the first two variables don't already exceed 75 before bothering to look at the third.
anthony68 (Programmer)
7 Sep 07 9:58
but i have to look at the third becouse val1+val4+val8>=75 and val12+val3+val6+val9>=75 that my goal.

the basic of the program is that any values no matter wich or how many are >=75 in the table
then the will form a group thats has >=75 those groups combined that i want to see
feherke (Programmer)
7 Sep 07 10:10
Hi

Quote (anthony68):

any values no matter wich or how many are >=75 in the table
And finally you wrote something relevant. Anyway, you already saw the syntax elements you will need. Now read about backtracking and you should be able to put the pieces together.

Feherke.
http://rootshell.be/~feherke/

anthony68 (Programmer)
7 Sep 07 19:23
i want this out put in the pascal program i made with exel;
    41    8    1    0    5    0    31    2    6    2    32    21
41    41    49    42    41    46    41    72    43    47    43    73    62
8    49    8    9    8    13    8    39    10    14    10    40    29
1    42    9    1    1    6    1    32    3    7    3    33    22
0    0    8    1    0    5    0    31    2    6    2    32    21
5    46    13    6    5    5    5    36    7    11    7    37    26
0    41    8    1    0    5    0    31    2    6    2    32    21
31    72    39    32    31    36    31    31    33    37    33    63    52
2    43    10    3    2    7    2    33    2    8    4    34    23
6    47    14    7    6    11    6    37    8    6    8    38    27
2    43    10    3    2    7    2    33    4    8    2    34    23
32    73    40    33    32    37    32    63    34    38    34    32    53
21    62    29    22    21    26    21    52    23    27    23    53    21

as you see the numbers in the x,y are x+y but i don't know how to begin..

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close