UML Diagram
LinkedList<-Queue
Why implement a method to determine if the queue is empty?
_______________ _______________ _______________ ______
UML Diagram
LinkedList<-Stack
Why implement a method to determine if the stack is empty?
Thanks!
User Profile
Collapse
-
Queue ADT & Stack ADT
-
BigInteger Problem
I am creating a GUI for class and need help with my program. My program takes 2 big integers and adds them together. First how do I declare my 2 Big Integers and then add them together? I have read the API docs , but still need help. Thanks!
...Code:import java.math.BigInteger; public class Integer { private BigInteger IntegerONE; // both entered as strings from GUI private BigInteger IntegerTWO; -
Sorting a String Array
My assignment is to write a program that accepts up to 10 names and corresponding birthdates. The array will be First name, Last name, and birthdate. Then allow the user to sort the list by first name or last name.
I need help on how to start. I know to use a for loop, but how do I begin the first String array assigned to first name, then last name, and then birthdate.
I am not asking for code, just some direction.... -
How do I reverse this PLEASE?...Code:void ShowArray (char name[MAXNAMES][LISTLENGTH],int x) { int length; for(int i= MAXNAMES-x; i<MAXNAMES; i++) {length= strlen(name[i]); for(int j=0; j<(length); j++) { cout << name[i][j]; } cout << endl; } }Leave a comment:
-
I need to alphabetically sort from A to Z, but my code is Z to A
My sort algorithm is sorting from Z to A, I need it to be A to Z PLEASE HELP
...Code:void SortArray (char names[MAXNAMES][LISTLENGTH]) { bool swap; int temp[LISTLENGTH]; do { swap=false; for (int i=0; i<MAXNAMES-1; i++) { if (strcmp(names[i],names[i+1])<0) { for (int j=0; j<LISTLENGTH; j++) { -
Help with sorting
...Code:void SortArray (char names[MAXNAMES][LISTLENGTH]) { bool swap; int temp[LISTLENGTH]; do { swap=false; for (int i=0; i<MAXNAMES-1; i++) { if (strcmp(names[i][0],names[i+1][0])>0) { for (int j=0; j<LISTLENGTH; j++) { temp[j]=names[i][j]; names[i][j]=names[i+1][j]; names[i+1][j]=temp[j]; -
Selection sort algorithm using strcmp
I need hints for an algorithm using string compare in a selection sort.
I will be sorting lastnames and first namesalphbetica lly. if the selection sort encounters the same last name it then goes to first name and alphabetizes the list.
Smith, John
Smith, Juan
THANKS IN ADVANCE!! -
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
const int MAXNAMES=100;
const int LISTLENGTH=61;
const int pass=100;
void ShowArray (char Array[MAXNAMES][LISTLENGTH]);
void SortArray (char Array[MAXNAMES][LISTLENGTH], int pass);
int main()
{
ofstream outputData; // Create an input file stream object
char Array[MAXNAMES][LISTLENGTH];...Leave a comment:
-
[QUOTE=Ganon11]All of this sounds good...have you come across any trouble yet?
When you are inputting data, you will have to separate each piece of information from the others. I would suggest making a Person class or struct that you can overload the < operator for - this will help immensely when doing your selection sort. Also, do you have to use selection sort? There are much quicker sorting algorithms out there - one such...Leave a comment:
-
Converting unsorted info from a file then alphabetically to a new file
I need to open a file that has unsorted list of names and birthdates formated like this: LASTNAME, FIRST$MM/DD/YYYY\n.It could have as much as 100 names. I will use a selection sort algorithm to alphabetize the list and store it in a new file named by the user. So how do I read the data from the file? Then take that information using a selection sort algorithm to alphabetize the list and store it in a new file? I know it's a 2D array
const... -
pointer help
#include<iostre am>
using namespace std;
const int index=5;
void getName(char,in t);
int main()
{
char string[21];
char *aString=string ;
for(int count=0;count<i ndex;count++)
{
getName(aString ,index);
cout << "you entered";
cout << names;
... -
Help with pointers Part 2
I need to write a driver(main) that uses the function below to get 5 names and then displays those names with characters up to 20
void getName(char names[][21],int index)
{
cout << "entera name:";
cin >> names[names];
} -
Help with pointers
I can't figure out how to fix this,can any one help me please:
void main()
{
char string[20];
char *aString=string ;
function(aStrin g);
}
void function(char *name)
{
cout << "enter name";
cin >> *name;
cout << name;
}
No activity results to display
Show More
Leave a comment: