Author
want to display the following output?
Andrew Musgrave
Greenhorn
Joined: Mar 19, 2012
Posts: 8
posted Mar 19, 2012 11:08:35
0

lets say the number of inputs is 3
i,j,k
range for them are 0-100, 2-200, and 3-300 (Range : Min Value-Max Value)
then the output should come
0 2 3
1 2 3
50 2 3
99 2 3
100 2 3
0 3 3
1 3 3
50 3 3
99 3 3
100 3 3
0 101 3
1 101 3
50 101 3
99 101 3
100 101 3
0 199 3
1 199 3
50 199 3
99 199 3
100 199 3
0 200 3
1 200 3
50 200 3
99 200 3
100 200 3
then first two columns repeat with 4 in last column
then 3+300/2 in last column
then 299 in last column
then 300 in last column
I would appreciate a hint and not the entire solution.
Thanks
This is the table generated for Worst Case Testing .
Andrew Musgrave
Greenhorn
Joined: Mar 19, 2012
Posts: 8
posted Mar 19, 2012 13:32:45
0

this program is to be coded in c++
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 18657
posted Mar 19, 2012 13:41:47
0

Is your problem that you don't know how to program this in C++ , or that you don't know how to program it?
Andrew Musgrave
Greenhorn
Joined: Mar 19, 2012
Posts: 8
posted Mar 20, 2012 04:25:06
0

This is my assignment
I coded a solution but, it seems to be way off the output
You can see for yourself
#include<iostream>
#include<stdlib.h>
#include<math.h>
using namespace std;
int main()
{
int n,x,c,u[100],m[100],e[100][5],j;
cout<<"Enter the number of variables";
cin>>n;
cout<<"Enter the Lower, and Upper Limits of the variables";
for(int y=0; y<n; y++)
{
cin>>m[y];
cin>>u[y];
}
c=(n*4)-4;
for(double k=0; k<n; k++)
{
int k1 = k;
int l=0,l1=1,l2=3,l3=4,l4=5;
double l00=0,l01=0,l02=0,l03=0,l04=0;
for(int i=1; i<=pow(5,n-(k+1)); i++)
{
l00 = l+pow(5,k);
while(l<l00){
e[k1][l] = m[k1];
l++;
}
l1 = l;
l01 = l1 + pow(5,k);
while(l1<l01)
{
e[k1][l1] = m[k1]+1;
l1++;
}
l2 = l1;
l02 = l2 + pow(5,k);
while(l2<l02)
{
e[k1][l2] = u[k1]-1;
l2++;
}
l3 = l2;
l03 = l3 + pow(5,k);
while(l3<l03)
{
e[k1][l3] = u[k1];
l3++;
}
l4=l3;
l04 = l4 + pow(5,k);
while(l4<l04)
{
e[k1][l4] = (u[k1]+m[k1])/2;
l4++;
}
l=l4+1;
}
}
double n1 = n;
for(int j=0; j<pow(5,n1); j++)
{
for(int d=0; d<n; d++)
{
cout<<e[d][j]<<"\t";
}
cout<<"\n";
}
system("PAUSE");
return 0;
}
Andrew Musgrave
Greenhorn
Joined: Mar 19, 2012
Posts: 8
posted Mar 20, 2012 04:32:47
0

basically the output should be in the form i presented in the first post
subject: want to display the following output?