C++ :: Sorting Car Names According To Their Mileage

Feb 24, 2013

All I wanted to do is to sort the car names according to their mileage. And display the output with their car names. This is what I've made

#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
int j;
class car

[Code].....

I need to take 5 car details and sort them according to their Mileage..

View 4 Replies


ADVERTISEMENT

C/C++ :: Sorting 10 Names And Searching For One

Mar 5, 2015

So I been asked to write a program that does the following:

Write a program that allows the user to enter a series of 10 names from the keyboard and then sorts and prints the names in alphabetical order. Use a series of functions:

1) Input the data
2) Sort the data (use a bubble sort)
3) Print the data

After this is done, allow the user to enter a name from the keyboard and determine if the name appears in the list. Use a function to accomplish the search. The name to be searched for should be input within main and sent to the function as an argument.

4) Search the data (use a binary search of type bool)"

this is whats I wrote so far and its giving me error with the sorting and the searching, I need to fix it and I cannot figure out how?!.

#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
void bubbleSort(string[], int);
int main()

[Code]....

View 3 Replies View Related

C/C++ :: Sorting Names In A Structure?

Sep 26, 2012

I cannot manage to get the code for sorting the names in alphabetical order.

#include<stdio.h>
#include<string.h>  
typedef struct{
    char criminalName[10];
    char criminalCase[20];

[code]....

View 3 Replies View Related

C++ :: Sorting Names And Numbers And Also Using Templates

May 7, 2013

For my project I have to sort 5 numbers and 5 names using a template bubble sort. I have one header for the numbers, and one for the names. This is what I have so far for my testing page:

#include "Floatheader.h"
#include "Nameheader.h"
#include <string>
int main ()
myFloat obj1;
myFloat obj2( 2.2, 5.1);

[Code] .....

I have to create a template to look like this: template<>....with a class inside the arrows. Then, I have to use bubble sort to sort the 5 names and number objects I have created. Sorting the names and numbers and also using templates?

View 1 Replies View Related

C++ :: Sorting Names Within Linked List

Oct 29, 2014

I am at a lost of how to sort names in alphabetical order after having the user input them into a linked list. I manage to create a program that did have the person input names into the linked list and when it is printed it displays the names in the order of how the user inputted the names.

#include <cstdlib>
#include <iostream>
using namespace std;
#include <string>
class NodeType {
public:
string NodeValue;

[Code] .....

View 1 Replies View Related

C++ :: Inserting File Of Names And Sorting Alphabetically?

Feb 25, 2013

A teacher has asked all her students to line up single file according to their first name. For example, in one class Amy will be in front of the line and Yolanda will be at the end.

Write a program that will read in a file of names. Names should be read until there are no more names to be read. Use LineUp.txt as a test file for your program.

Once all the names have been read in display which student will be at the front of the line and which one would be at the end of the line. You may assume that no two students have the same name.

These are the name in the LineUp.txt file if needed:
Cooper
Gavin
Joseph
Sierra
Kacie
Dylan
Kaylee
Will

and so on .....

View 1 Replies View Related

C++ :: Sorting Data - Output Names And Ages In Ascending Order

Oct 24, 2013

I am having problems sorting data... I don't know to to go about it here is my code:

<code>
#include <iostream>
#include <string>
using namespace std;
int main () {
int i;
struct person

[Code] ....

i want to sort it out so that it can output names and ages in ascending order.

View 2 Replies View Related

C :: Sorting Array Alphabetically - Print 10 Names In Ascending Or Descending Order

Apr 9, 2014

//Build a program that uses a single-dimension array to store 10 names input by a user.

//After inputting the names, the user should see a menu with two options to sort and print the 10 names in ascending or descending order.

insert
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char names[10];
char temp[10];
int count,i,j;
int sort;

[Code] .....

View 10 Replies View Related

C++ :: SQLite - Add All The Mileage Between Two Dates

Feb 4, 2013

I have a simple table in SQLite:

Column 1: vistDate (stored as date)
Column 2: mileage

As a test, I created one row,
visitDate = 03/02/2013
Mileage = 10

I want to be able to add all the mileage between two dates but in my SQLite query, it returns zero mileage if the first date is not in the same month.

I am inputting the dates in the dd/mm/yyyy format above. It works fine for

Date 1: 01/02/2013
Date 2: 04/02/2013

i.e. 10 miles is returned as answer

but if Date1: 30/01/2013 I get Null.

Here's the query:

SQLiteExec("SELECT SUM(mileage) FROM mileageTable WHERE visitDate BETWEEN '01/02/2013' AND '04/02/2013')

View 6 Replies View Related

C++ :: Delete Specified Names From A List Of Store Names?

Feb 10, 2013

i have a vector of stores. i would like to delete the specified choice(store) from the list. Here is what i have but my erase statement is wrong and wont compile.

void Store::deleteSpecifiedStoreFromList(string choice) {
for (int i = 0; i < this->stores.size(); i++) {
if(this->stores[i].getStoreNames() == choice) {
this->stores.erase( std::remove_if( this->stores.begin(), this->stores.end(), choice ), this->stores.end() );
}
}
}

View 4 Replies View Related

C :: Array Of File Names

Feb 9, 2013

I am trying to create an array of file names such that when I want to open one of the files, who's name is given in the array, I can call that element of the array. My code for making the array is the following,

Code:
char file_name[40];
char *file_locations[N]; // array of N names (*)
for(ii=0; ii<=N-1; ii++){ // printing the names of all the files P1_8mag_1.txt - P1_8mag_N.txt
sprintf(file_name, "P1_8mag_%i.txt", ii+1);

[Code]....

The problem with this is that in the first step: all elements of the array "file_locations" are the name of the last file in the loop (in this case "P1_8mag_N.txt")What is wrong with this?

View 12 Replies View Related

C :: Display The Names In A Queue

Mar 12, 2014

I have an assignment that needs to display the names of customers to be served according to a sequence. coding to display the names accordingly?

Code:

#include <stdio.h>
#include <stdlib.h>
#define MAXIMUM 20
void create();

[Code].....

This is my output. I have trouble displaying the names of the customers as it outputs null when I try to display my position in queue.

View 4 Replies View Related

C :: Pointer - How To Accept 50 Names

Mar 24, 2013

char *name[50]

How to accept 50 names using above definition...

View 3 Replies View Related

C++ :: Splitting First And Last Names From String

Jan 15, 2013

The following code shows bad memory access error (segmentation fault) when I run it. It does this right after it asks for name and the user has entered it.

#include <iostream>
#include <sstream>
using namespace std;
struct Name {
string first;
string last;

[Code] ....

View 4 Replies View Related

C++ :: Find A Name In Struct Of Names

Jul 6, 2014

I cannot find the second name in the struct. First name comes out ok here is the code. I am reading from a file.

struct asma{
char name[200];
char birth[100];

[Code].....

View 2 Replies View Related

C# :: How To Get Column Names From Db3 File

Oct 2, 2014

I have .db3 file, and he has 14 tables,and every table has certain number of columns. Example i have table called "BASIC_INFO" and that table has columns "First Name", "Last Name" and "Age".

How can i get name of table and name of every column,so if i some day add column "Male" i get name of this column too. I need first to calculate number of columns,put that in some integer, and then for example create string array which will contain : array[0] = "First Name" ,array[1] = "Last Name"...

SQLiteConnection myConn = new SQLiteConnection("Data Source=" + DB3Path + ";Version=3;New=False;Compress=True;");
//string query = "Select * From " + DB3Path + ".INFORMATION_SCHEMA.COLUMNS";
string query = "Select * From BASIC_INFO.INFORMATION_SCHEMA.COLUMNS;";
SQLiteCommand sqCommand = new SQLiteCommand(query);

[Code] ....

I tried this too:

string query = "select * from INFORMATION_SCHEMA.COLUMNS"
+ "where TABLE_Name='BASIC_INFO'"
+ "order by ORDINAL_POSITION;";
string query = "SELECT TOP 0 * FROM BASIC_INFO";

View 2 Replies View Related

C/C++ :: Display Names In A Queue?

Mar 13, 2014

I have encountered errors when trying to display the customers' names in a priority queue.

#include <stdio.h>
#include <stdlib.h>
#define MAXIMUM 20
void create();
void priority_insert(int data);
void check(int data);

[code]....

I have gotten the following output:

Peter
Peter
<Null>

How do I correct my coding to display like below:

John
Peter

View 1 Replies View Related

C++ :: Get 15 Names And Then Hash Them - Segmentation Fault

May 3, 2013

The point of this code is to get 15 names and then hash them. After one name is entered I get a segmentation Fault and the program crashes.

Code:
//driver file
#include <iostream>
#include <vector>
#include <string>
using namespace std;

[Code] ....

View 7 Replies View Related

C++ :: Finding Names That Start With A Certain Letter

May 30, 2013

I am doing a homework assignment. I do not want the complete answer, just a hint. I have to load a file of names into an array, display the names, then sort the names alphabetically, display them again, then list how many names start with certain letters. I have everything done but how to display how many names start with a certain letter.

Here are the names:

Collins, Bill Smith, Bart
Allen, Jim
Griffin, Jim
Stamey, Marty
Rose, Geri
...........

And here is the code I have so far.

Code:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <algorithm>

[Code] ....

View 5 Replies View Related

C :: Use Names Of Taxi As Registration Instead Of Numbers?

Apr 15, 2013

ive done a code for taxi's that arrive and depart, but i was wondering how i can use names of taxis as registration instead of numbers?

View 1 Replies View Related

C :: CLASS Keyword In Function Names

Sep 24, 2014

I'm trying to read a C code, but there are functions including CLASS word at the titles of functions. Is it a correct implementation?

For example: double CLASS getreal (int type)

What is the meaning of CLASS in titles of functions in C? I could not find such an usage in my C book?

View 6 Replies View Related

C :: Using Variable Names When Calling MC PIN High Or Low

Feb 9, 2013

I haven't tried to run my program yet, but maybe I will save some trouble if I ask this question first.I am using MC PIC16F690, and I could make a pin high or low by writing RCx = 1 or 0, where x is the pin in the C port. However, I want to use the counter variable from a for() loop as the pin number. Will RC(variablename) = 1 work, or is there another syntax?

View 2 Replies View Related

C :: How To Generate Random Color Names

Sep 7, 2013

I want to print different color names for "nb " times . I get the number " nb " from the user or from text file . if " nb = 3 " then I want to print any 3 different color names which means that I may print ( red , green , blue ) for example . and if " nb=5 " then I have to print any five different color names ( pink , blue , black , red ,white ) fore example .

Note : " nb " may be a large number ( 17 for example ). How can I do this ?

View 2 Replies View Related

C++ :: How To Address Files Having Spaces In Their Names

Aug 30, 2013

i wonder how does any os address file having spaces in their names.Even cmd.exe in windows can't access such file but windows explorer can. How is it so?

View 4 Replies View Related

C++ :: Input Three Names And Print Each One At Different Line

Dec 10, 2014

We need a program that takes three names ( first middle last ) and print it each one at a different line...

View 5 Replies View Related

C++ :: Changing State Names To Abbreviations?

Feb 13, 2014

The purpose of the code is to read in state names, say california and print CA. However, if it was a state with two words, it would read in only the first letter of each. I.E New Hampshire would be NH.

here's my code:
#include <iostream>
#include <iomanip>
#include <cctype>

[Code].....

I am able to get the one word states and tried getting the two word states but it doesnt work.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved