Show Bid Request
Item display
Bid Request Id: 13807
|
|
|
Posted by: |
BalanusBob (1 ratings)
(Software buyer rating 10)
|
Posted: |
Apr 17, 2002 2:24:19 PM EDT
|
Bidding Closes: |
Apr 18, 2002 5:39:55 PM EDT
|
Viewed (by coders): |
138 times
|
|
|
|
Description:
I have a program where I need to display a list of up to 20 items in two columns instead of one. I can get the items(from a char array Items[20][32]) to display alphabetically down the page after sorting, and using a counter it stops at 20 items. How do i break the display in two, so that I have two equal columns( with one extra item in the first column when there are an odd number of items) and have the two columns be equidistant from each other and from the margins of the page? I used a for loop with Items[Count]to stop the list at 20 items.
Deliverables: Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
Complete copyrights to all work purchased.
//Then another prompt will tell them to type an element into the list.
//They will be told to type "0" when they want to end the list.
// A bubble sort will alphabetize the list. Then the ClearScreen and SolidLine
//functions will format the output. Finally, the list will be printed.
#include <iostream.h>
#include <string.h>
#include <iomanip.h>
#include <stdlib.h>
#include <windows.h>
void GetString (char [], char []); // Function prototype
void clrscr (); // Function prototype
void SolidLine (char); //Function prototype
void SortBubble (char[][32], int);//Function prototype
void main (void)
{
//The main function calls the other necessary functions without
//receiving any, or returning any arguments. It sends two array arguments
//to the GetString function, sorts them, and calls the other two functions of the program
//as well. From this main function, all formatting and printing are done.
char Items[20] [32];//Two dimensional array, with 20 rows, 32 columns.
char Title[32];//integer array for input
GetString(Title, "Enter the title of your list: ");
//Enter values into each row of the array.
//Stop when 0 is typed in.
for (int Count=0; Count < 20; Count++)
{
GetString(Items[Count], "Type an element into the list, or 0 to end: ");
if (strcmp(Items[Count],"0") ==0)
break;
}
SortBubble( Items, Count );
clrscr();
SolidLine('*');
cout<< "\t\t\t\t"<<Title << endl;
SolidLine('*');
/* ///////////// don't know what to do with this
commented section. It is probably not relevant here.
for(int x =0; x<Count; x++)
{
for(int y=0;y <=strlen(Items[x]);y++)
{
cout<<Items[x][y];
if(x%2)
cout<<;
else cout<<endl;
}
}
*/
////this is the area in question.
for (int Index=0; Index< (Count); Index++)
{
cout<<"\t\t\t\t"<<(Items[Index], Items[0][32]);
cout<<"\t\t\t\t"<<(Items[Index], Items[19][32])<<endl;
}
//if (strlen (Items[Index]))
// cout<<"\t\t\t\t";
// else cout<<endl;
SolidLine('*');
}
//Function definition for Getstring.
//This function accepts a two-dimensional integer array as an
//argument. The array has 32 columns. The other argument is the number of
//rows in the array.
void GetString(char Array1 [], char Array2 [] )
{
cout<< Array2<<endl;
cin.getline(Array1, 32);
}
//This function sorts the letters of the string as they are entered into the
//array.
void SortBubble(char Array [][32], int Items)
{
int Swap;
char Temp[32];
do
{
Swap=0;
for (int Index=0; Index < (Items-1); Index++)
{
if (strcmp(Array[Index], Array[Index +1]) >0)
{
strcpy(Temp, Array[Index]);
strcpy(Array[Index],Array[Index +1]);
strcpy(Array[Index +1],Temp);
Swap=1;
}
}
}while (Swap !=0);
}
//This function clears the screen so the heading to the report can be outputted.
void clrscr()
{
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord = {0, 0};
DWORD count;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hStdOut, &csbi);
FillConsoleOutputCharacter(hStdOut, ' ', csbi.dwSize.X * csbi.dwSize.Y, coord, &count);
SetConsoleCursorPosition(hStdOut, coord);
}
//Function SolidLine outputs asterisks to make line.
void SolidLine(char Star)
{
//A for loop for printing same character 80 times.
for (int StarCount=0; StarCount < 80; StarCount++)
{
cout<<Star;
}
}
Platform:
Windows would be fine.
Special Conditions / Other:
I need this by Thursday, 4/18/02, but, will settle for Friday.
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation, you can report it to: abuse@rentacoder.com.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
This bid was accepted by the buyer!
|
$10 (USD)
|
Apr 17, 2002 4:01:58 PM EDT
|
9.6
(Excellent)
|
|
|
Don't go for low price coders as this is a project with the time limit.So i assure you if you select my bid you would get the work in time.You can check my ratings. |
|
|
|
|
|