Question about Intelligent Computer Compilers & Programming Tools

1 Answer

Sorting string and numeric

Focus on the user if the user want to sort for string or numeric

Posted by on

1 Answer

  • Level 1:

    An expert who has achieved level 1.

    Governor:

    An expert whose answer got voted for 20 times.

    Corporal:

    An expert that has over 10 points.

    Mayor:

    An expert whose answer got voted for 2 times.

  • Contributor
  • 9 Answers

One simple way to achieve this is using radio button function. Give the user flexibility to change sorting via String or Numeric. As the user clicks on String the result bottom of this option will change the sorting method using String. Otherwise, Numeric.

By the way, please be specific in posting your question. Include the development tools that you use. For example, MS Access 2003.

Regards,
Maha

Posted on Feb 05, 2009

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

3 Answers

A java code for anagram


import java.io.IOException;

public class AnagramApp {
static int size;

static int count;

static char[] charArray;

public static void main(String[] args) throws IOException {
String input = "Java Source and Support";
size = input.length();
count = 0;
charArray = new char[size];
for (int j = 0; j < size; j++)
charArray[j] = input.charAt(j);
doAnagram(size);
}

public static void doAnagram(int newSize) {
int limit;
if (newSize == 1) // if too small, return;
return;
// for each position,
for (int i = 0; i < newSize; i++) {
doAnagram(newSize - 1); // anagram remaining
if (newSize == 2) // if innermost,
display();
rotate(newSize); // rotate word
}
}

// rotate left all chars from position to end
public static void rotate(int newSize) {
int i;
int position = size - newSize;
// save first letter
char temp = charArray[position];
//shift others left
for (i = position + 1; i < size; i++)
charArray[i - 1] = charArray[i];
//put first on right
charArray[i - 1] = temp;
}

public static void display() {
System.out.print(++count + " ");
for (int i = 0; i < size; i++)
System.out.print(charArray[i]);
System.out.println();
}
}

Nov 22, 2010 | Compilers & Programming Tools

1 Answer

Design the program 3 grades output the grades according to each rank


#include <string>
#include <fstream>

#define MAX_NUM_STUDENTS 15
#define MAX_LEN_NAME 20
#define LEN_SSN 10

enum Rank {Freshment, Sofomore, Junior, Senior};
enum letGrade {A, B, C, D, F};

class StuRecord {
public:
void ReadRecord(ifstream& inputFile);
// Precondition:
// Input stream inputfile is opened and the file is not empty.
// Postcondition:
// The next student record in the input file is read and stored
// in this object. The rank is save as a value of the enumeration
// type "letGrade" according to the read-in numeric rank number.
void Average();
// Precondition:
// The 3 grades (grade1, grade2, and grade3) are assigned.
// Postcondition:
// Find the average of the 3 grades.
void LetterGrade();
// Precondition:
// The average is assigned.
// Postcondition:
// Determine the letter grade according to the average.
void Print() const;
// Precondition:
// name, ssn, rank, and grade are assigned.
// Postcondition:
// Print out the student record.
StuRecord();
// Default constructor.

private:
string name;
string ssn;
Rank rank;
letGrade grade;
int grade1, grade2, grade3, average;
};

And a source file...which i am not sure what to do from this point forward =(

#include "project 1.h"
#include <iostream>
#include <fstream>

using namespace std;




enum Rank {Freshment, Sofomore, Junior, Senior};
enum letGrade {A, B, C, D, F};
struct StuRecord
{
string name;
string ssn;
Rank rank;
letGrade grade;
int grade1, grade2, grade3, average;
};

Jul 08, 2010 | Compilers & Programming Tools

1 Answer

Alphabetical order format in MSWord


just highlight the list using your mouse or similar mechanismas if you were going to copy-and-paste them,Then select "Table" from the Word toolbar,
then select "Sort",then click "OK" your menus might have slightly different spellings)
Given the following example:
bread
apples
Zebras
Flora
Fauna
Gorillas
lemurs
Camels

They were sorted to the following using the above method:

apples
bread
Camels
Fauna
Flora
Gorillas
lemurs
Zebras

This also works if the lists has "Bullets and Numbering";
the resulting list will maintain the bullet/number order
(i.e., the numbers won't change;
e.g., in the above example,
if the unsorted "bread" was "1. bread",
then the sorted "bread" would become "2. bread",
and "apples" would become "1. apples", etc).

If you don't like the result,
then hit the "Ctrl" and "z" keys at the same time
to undo the sort.

The above method will NOT work if the to-be-sorted words
are on the same line, as with a comma-separated list
(e.g., bread, apples, Zebras, etc).

Have fun!

If you *do* have intervening stuff, such as images, etc,
then they will be sorted along with the desired words,
but the results may not be what you expect,
and you may have to do a LOT of editing to put things
the way you want, so make sure that the to-be-sorted words are on their own lines with no intervening stuff

Mar 05, 2010 | Compilers & Programming Tools

1 Answer

Need to write a simple (no array allowed) to take three inputs from a user and sort it numerically. Not just provide the MAXNUM. via Javascript


in pCode

Var1 = Input1
Var2 = input2
Var3 = input3

If Var1 > Var2 and Var3
Then Var1 is Max
If Var1 > Var2 and < Var3
then Var3 is Max
Else Var2 is Max

If Var1 is Max and Var 2 > Var3
Then Var1 = Max
Var2 = Mid
Var3 = Min

if Var2 is Max and Var >1 Var3
Then Var2 = Max
Var1 = Mid
Var3 = Min

Repeat the various possibilities and you have got your result without arrays

Oct 05, 2009 | Compilers & Programming Tools

1 Answer

Vb projects


One of the assignments given for a masters
was to provide an input box for english postcodes (zip fer other places) that would filter out ANY invalid input in as few lines as possible.

With entirely numeric that is simple as it is just a string length
but some countries use alpha numeric and the letters have to be in the correct places eg. wf15 9lf or WF15 9LF or W15 would all be valid but W15 9LF would not..

Again minimal code would show an attention to detail because anyone can write a 100 lines of code to do that try get it in 15 or much less and it becomes more impressive


Specific alpha numeric data input and format sorting always seems to go down well with professors.

I havent given you everything to write the abstract bu the bare bones are there and it gives you an idea of the types of thing looked for.

After all if I gave you the whole thing it would not have been your work.

Aug 25, 2009 | Microsoft Compilers & Programming Tools

1 Answer

Retrieving acess data which is password protected thru VB


You will need to use a connection string. But - before you can configure the string correctly, I'd need to know how the data is stored (Access, SQL, ODBC, etc). You can find examples online. Just know that you are looking for "Connection String." Here's two examples:
1. For MS Access (Jet files):
' Set up the connection string.
m_strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDestDBPath & ";" & _
"Jet OLEDB:Engine Type=5" ' NOTE: Use Type=5 for Jet 4.x.

2. For SQL database:
g_strADOConn = "Provider=SQLOLEDB;" & _
"Data Source=SERVER_NAME;" & _
"Initial Catalog=DATABASE_NAME;" & _
"User ID=mssql_userid;" & _
"Password=mssql_password;"

Apr 22, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

How to shortlist combobox items at runtime ?


Each time a letter is typed by your user, re-query from the 50 and return ONLY those meeting what your user typed. Clear and re-populate the ComboBox. Also - Set the Sorted property to True!

Mar 30, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

Insertion sort


<!--StartFragment-->
Function InsertionSort(ByVal TempArray As Variant) As Variant
' Written By Louis Sutherland
' 1/25/99
' will be the sorted arrary when finishe
' d
Dim SortedList As Variant
Dim x, y As Integer
Dim NumSorted As Integer
'This Set up SortedList as an Array
SortedList = TempArray
'This zeroizes the new array


For x = 1 To UBound(SortedList)
SortedList(x) = 0
Next x
'sets the Total num counted to 1
NumSorted = 1
' Processes first element
SortedList(1) = TempArray(1)


For x = 2 To 5000
' insertion loop


For y = NumSorted To 1 Step -1
' if current value is <= then insert in
' next place


If TempArray(x) >= SortedList(y) Then
SortedList(y + 1) = TempArray(x)
'This Breaks the loop
y = 1
Exit For
Else


If y = 1 Then
SortedList(y + 1) = SortedList(y)
SortedList(y) = TempArray(x)
Exit For
Else
' save the value to the next spot
SortedList(y + 1) = SortedList(y)
End If
End If
Next y
'advance total num sorted
NumSorted = NumSorted + 1
Next x
InsertionSort = SortedList
End Function




Mar 17, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

How to arrange floders by name in vista


This a VB6 or Windows Vista problem.

In vista to sort folder by name, go to the folder that they are in, right click and Sort by -> Name

You may want to check that Group By is set to None.

Jan 25, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

C++ problem


I guess this can be done quite easily with stl sort function:
http://www.sgi.com/tech/stl/sort.html
You can also code a sorting algorithm like quicksort or bubblesort yourself. This is quite fun!

Nov 28, 2008 | Compilers & Programming Tools

Not finding what you are looking for?
Compilers & Programming Tools Logo

Related Topics:

143 people viewed this question

Ask a Question

Usually answered in minutes!

Top Intelligent Computer Compilers & Programming Tools Experts

Robin Hill
Robin Hill

Level 3 Expert

1251 Answers

Fred Block
Fred Block

Level 2 Expert

289 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18304 Answers

Are you an Intelligent Computer Compiler and Programming Tool Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...