473,480 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

minimum

24 New Member
how to get the minimum values from the number that I have generate?

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <cstdlib> 
  4. #include <math.h>
  5. #include <stdio.h>
  6. #include <time.h>
  7. using namespace std;
  8.  
  9.     int i, j;
  10.     int x[10];
  11.     int A[10], B[10], C[10], D[10], E[10], F[10]; 
  12.  
  13.     int  main(void)
  14. {
  15. {
  16.     for(i=1;i<7;i++)
  17.  
  18. {
  19.     for(i=1;i<7;i++)
  20. {
  21.     x[i]=i;
  22.     A[i]=(2+pow(x[i],2));
  23.     B[i]=(1+pow(x[i],3));
  24.     C[i]=(2+pow(x[i],2)-1);
  25.     D[i]=(3*pow(x[i],3));
  26.     E[i]=(1+pow(x[i],2));
  27.     F[i]=(3+pow(x[i],2));
  28. }
  29. {
  30.     printf("\n");
  31.  
  32.     for(i=1;i<7; i++)
  33.  
  34. {   
  35.     printf("[%d][%d] A[%d]=%d\n", i,1, i, A[i]); 
  36. }
  37.     printf("\n");
  38.     for(i=1;i<7; i++)
  39.  
  40. {   
  41.     printf("[%d][%d] B[%d]=%d\n", i,2, i, B[i]); 
  42.  
  43.     printf("\n");
  44.     for(i=1;i<7; i++)
  45.  
  46. {   
  47.     printf("[%d][%d] C[%d]=%d\n", i,3, i, C[i]); 
  48.  
  49. }
  50.     printf("\n");
  51.     for(i=1;i<7; i++)
  52.  
  53. {   
  54.     printf("[%d][%d] D[%d]=%d\n", i,4, i, D[i]); 
  55.  
  56. }
  57.     printf("\n");
  58.     for(i=1;i<7; i++)
  59.  
  60. {   
  61.     printf("[%d][%d] E[%d]=%d\n", i,5, i, E[i]); 
  62. }        
  63.     printf("\n");
  64.     for(i=1;i<7; i++)
  65.  
  66. {   
  67.     printf("[%d][%d] F[%d]=%d\n", i,6, i, F[i]); 
  68. }
  69. }
  70. }
  71. }
  72.     printf("\n");
  73.  
  74.     printf  ("A\tB\tC\tD\tE\tF");
  75.     printf  ("\n_\t_\t_\t_\t_\t_\t");
  76.  
  77.     for(i=1;i<7;i++)
  78. {
  79.     cout<<endl;
  80.  
  81.     printf("%d\t",  A[i]);
  82.     printf("%d\t",  B[i]);   
  83.     printf("%d\t",  C[i]);
  84.     printf("%d\t",  D[i]);
  85.     printf("%d\t",  E[i]);
  86.     printf("%d\t",  F[i]);
  87. }
  88.     _getch();
  89. }
Oct 28 '07 #1
6 1544
amitpatel66
2,367 Recognized Expert Top Contributor
how to get the minimmum valuesfrom the number that I have generate?

#include <iostream>
#include <conio.h>
#include <cstdlib>
#include <math.h>
#include <stdio.h>
#include <time.h>
using namespace std;

int i, j;
int x[10];
int A[10], B[10], C[10], D[10], E[10], F[10];

int main(void)
{
{
for(i=1;i<7;i++)

{
for(i=1;i<7;i++)
{
x[i]=i;
A[i]=(2+pow(x[i],2));
B[i]=(1+pow(x[i],3));
C[i]=(2+pow(x[i],2)-1);
D[i]=(3*pow(x[i],3));
E[i]=(1+pow(x[i],2));
F[i]=(3+pow(x[i],2));
}
{
printf("\n");

for(i=1;i<7; i++)

{
printf("[%d][%d] A[%d]=%d\n", i,1, i, A[i]);
}
printf("\n");
for(i=1;i<7; i++)

{
printf("[%d][%d] B[%d]=%d\n", i,2, i, B[i]);

}
printf("\n");
for(i=1;i<7; i++)

{
printf("[%d][%d] C[%d]=%d\n", i,3, i, C[i]);

}
printf("\n");
for(i=1;i<7; i++)

{
printf("[%d][%d] D[%d]=%d\n", i,4, i, D[i]);

}
printf("\n");
for(i=1;i<7; i++)

{
printf("[%d][%d] E[%d]=%d\n", i,5, i, E[i]);
}
printf("\n");
for(i=1;i<7; i++)

{
printf("[%d][%d] F[%d]=%d\n", i,6, i, F[i]);
}
}
}
}
printf("\n");

printf ("A\tB\tC\tD\tE\tF");
printf ("\n_\t_\t_\t_\t_\t_\t");

for(i=1;i<7;i++)
{
cout<<endl;

printf("%d\t", A[i]);
printf("%d\t", B[i]);
printf("%d\t", C[i]);
printf("%d\t", D[i]);
printf("%d\t", E[i]);
printf("%d\t", F[i]);
}
_getch();
}
You want to find the minimum from all the arrays you are using in your code??
Oct 28 '07 #2
keith katthy
24 New Member
yes. like that.
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include "ayam.cpp"
  3. using namespace std;
  4.  
  5. int Min(const int *Numbers, const int Count)
  6. {
  7.     int Minimum = Numbers[0];
  8.  
  9.     for(int i = 0; i < Count; i++)
  10.         if( Minimum > Numbers[i] )
  11.             Minimum = Numbers[i];
  12.  
  13.     return Minimum;
  14. }
  15.  
  16. double Min(const double *Numbers, const int Count)
  17. {
  18.     double Minimum = Numbers[0];
  19.  
  20.     for(int i = 0; i < Count; i++)
  21.         if( Minimum > Numbers[i] )
  22.             Minimum = Numbers[i];
  23.  
  24.     return Minimum;
  25. }
  26.  
  27. int main()
  28. {
  29.     int Nbrs[] = { A[i] };
  30.     int Total = sizeof(Nbrs) / sizeof(int);
  31.  
  32.     int Minimum = Min(Nbrs, Total);
  33.     cout << "Minimum: " << Minimum << endl;
  34.  
  35.     return 0;
  36. }
Oct 28 '07 #3
Ganon11
3,652 Recognized Expert Specialist
Are you using C or C++? I see a lot of printf statements in there, which suggests C to me, but you are also including "ayam.cpp" which says C++ to me. Go with one or the other - it's not always a great idea to mix the two, as C can get messy.
Oct 28 '07 #4
weaknessforcats
9,208 Recognized Expert Moderator Expert
#include "ayam.cpp"
You do not include source files.

If you have three source files in your program and two of them include the third, then everything inthe included source file is duplicated and that will cause redefinition errors in the link step.

You add the source files to your project and you use function prototypes to call the functions not in the current file.
Oct 28 '07 #5
keith katthy
24 New Member
i use c++, but i dont how to use cout, so I use , printf. My question, is how to call the data A[i]?
Oct 29 '07 #6
sicarie
4,677 Recognized Expert Moderator Specialist
i use c++, but i dont how to use cout, so I use , printf. My question, is how to call the data A[i]?
Just like that.

Keith Katthy - this is an official warning. Keep all questions based on the same code in a single thread. The rules to this site are defined clearly in the Posting Guidelines, and you are now responsible for knowing and following all of them. Failure to do so will result in action taken against your account.
Oct 29 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
6036
by: Lobang Trader | last post by:
Hi all, I am trying to create a username and a password class. I would like to know what are the RECOMMENDED minimum and maximum length for both fields? These fields will be something like...
1
1533
by: Mitch Olson | last post by:
Hi our company is just about to embark on developing a PIM-type application and would like to use .NET (VB6 is our distant option 2). The question we are currently investigating is whether the...
3
2125
by: Harry_Crow | last post by:
I want to restrict the minimum size of the form. I find that there are properties MaximumSize and MinimumSize. This will help you control the maximum and minimum size the form, when the form is...
2
1891
by: Hennie de Nooijer | last post by:
I have a problem (who not?) with a function which i'm using in a view. This function is a function which calculates a integer value of a date. For example: '12/31/2004 00:00:00" becomes 20041231....
2
2306
by: Hennie de Nooijer | last post by:
Because of an error in google or underlying site i can reply on my own issue. Therefore i copied the former entered message in this message....
1
4558
by: Vikrant | last post by:
On my DB2/UDB system, some tablespace 'Minimum recovery time' is 2000-11-19 or some '1999-10-04' or different, for some tablespace theres is no 'Minimum recovery time' , what does it tell me? ...
12
16877
by: David Sworder | last post by:
Hi, I'm writing an application in which a client (C#/WinForms) and server (C#/service) interact with one another. The client establishes a "session" with the server but for scalability reasons...
11
8737
by: JJLaRocque | last post by:
Hi all, Is there a simple python function to return the list index of the minimum entry in a list of lists? ie, for , , ] to return 2,4. Or, same question but just for a list of numbers, not a...
3
2062
by: manxie | last post by:
Dear All Readers, I'm supposed to create a program with a switch and using voids to execute number of codes, that includes finding sum, average, maximum, and minimum, please read my code:...
13
2709
by: Ioannis Vranos | last post by:
Is there any mentioning in the standard of the number of bits of the various built in types, apart from char/signed char/unsigned char types? Or only about the minimum value ranges of them?
0
7037
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7080
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6895
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5326
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2992
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1296
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
176
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.