Example
#{example}"); ipb.editor_values.get('templates')['togglesource'] = new Template(""); ipb.editor_values.get('templates')['toolbar'] = new Template(""); ipb.editor_values.get('templates')['button'] = new Template("
Emoticons
"); // Add smilies into the mix ipb.editor_values.set( 'show_emoticon_link', false ); ipb.editor_values.set( 'bbcodes', $H({"snapback":{"id":"1","title":"Post Snap Back","desc":"This tag displays a little linked image which links back to a post - used when quoting posts from the board. Opens in same window by default.","tag":"snapback","useoption":"0","example":"[snapback]100[/snapback]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"topic":{"id":"5","title":"Topic Link","desc":"This tag provides an easy way to link to a topic","tag":"topic","useoption":"1","example":"[topic=1]Click me![/topic]","switch_option":"0","menu_option_text":"Enter the topic ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"post":{"id":"6","title":"Post Link","desc":"This tag provides an easy way to link to a post.","tag":"post","useoption":"1","example":"[post=1]Click me![/post]","switch_option":"0","menu_option_text":"Enter the Post ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"spoiler":{"id":"7","title":"Spoiler","desc":"Spoiler tag","tag":"spoiler","useoption":"0","example":"[spoiler]Some hidden text[/spoiler]","switch_option":"0","menu_option_text":"","menu_content_text":"Enter the text to be masked","single_tag":"0","optional_option":"0","image":""},"acronym":{"id":"8","title":"Acronym","desc":"Allows you to make an acronym that will display a description when moused over","tag":"acronym","useoption":"1","example":"[acronym='Laugh Out Loud']lol[/acronym]","switch_option":"0","menu_option_text":"Enter the description for this acronym (EG: Laugh Out Loud)","menu_content_text":"Enter the acronym (EG: lol)","single_tag":"0","optional_option":"0","image":""},"hr":{"id":"12","title":"Horizontal Rule","desc":"Adds a horizontal rule to separate text","tag":"hr","useoption":"0","example":"[hr]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"1","optional_option":"0","image":""},"php":{"id":"14","title":"PHP Code","desc":"Allows you to enter PHP code into a formatted/highlighted syntax box","tag":"php","useoption":"0","example":"[php]$variable = true;\n\nprint_r($variable);[/php]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"html":{"id":"15","title":"HTML Code","desc":"Allows you to enter formatted/syntax-highlighted HTML code","tag":"html","useoption":"0","example":"[html]\n \n[/html]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"sql":{"id":"16","title":"SQL Code","desc":"Allows you to enter formatted/syntax-highlighted SQL code","tag":"sql","useoption":"0","example":"[sql]SELECT p.*, t.* FROM posts p LEFT JOIN topics t ON t.tid=p.topic_id WHERE t.tid=7[/sql]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"xml":{"id":"17","title":"XML Code","desc":"Allows you to enter formatted/syntax-highlighted XML code","tag":"xml","useoption":"0","example":"[xml]2 Replies - 28 Views - Last Post: Today, 06:04 PM
#1
Reputation: 0
- Posts: 3
- Joined: Today, 09:10 AM
Posted Today, 10:41 AM
I have to to a c++ project which should define the abstract data type "Ordered list". I have to perform binary search and bubble sort.Here is my codes...My project is not even running.....
#include "arraylist.h" #include <iostream> #include <string> #include <time.h> #include <fstream> #include <stdio.h> #include <array> #include <vector> #include <list> using namespace std; using std::list; using std::string; //Global vaiables int const MAX = 0; char option; int Count; int Credit; int binarysearch(int[],int,int); //End Global variables //List functions void write_File(); void display_Menu(); void execute_Menu(); void process_Option(); void Add_New_Customer(); void Delete_Customer(); void isempty(); void isfull(); void bubblesort(int[],int); //End List functions //Create Structure for customer struct Customer { int membership_number; string foreName; string surname; string membership_type; }; int linearSearch (Customer*customer,int membership_number,const string forename, const string surname, const string membership_tyoe,int totalCustomers); // End Create Struture for customer Customer customerList[]; int main(void) { int membership_number; string foreName; string surname; string membership_type; int i ,j; for(i=0;i<=5;i++) { std::cout << "Please Enter Membership Number: "; cin >> membership_number; } for(i=0;i<=4;i++) { Customer customer[] = { {1234,"John","Smith","senior" }, {2456,"Emma", "Fagan", "junior"}, {1567,"David","Johnson","day"}, {7648,"Dean", "Mclean","junior"}, {5425,"Becky", "Thom", "senior"}, }; Customer *recPoint; int totalCustomers=5; int membership_number; string forename; string surname; string membership_type; int found; list<string> Ordered_List; // Ordered_List.push_back("Hello"); execute_Menu(); void execute_Menu(); { do { display_Menu(); process_Option(); } while(option!=0); } void display_Menu(); { do { cout << "CUSTOMER DETAILS" ; cout << endl << endl; cout << "PLEASE SELECT AN OPTION FROM THE LIST BELOW: "; cout << endl << endl; cout << "0 - EXIT"; cout << endl; cout << "1 - ADD NEW STUDENT"; cout <<endl; cout << "2 - DELETE STUDENT"; cout << endl << endl; cout << "Please enter an option"<< endl << endl; cin>>option; cin.ignore(1); if (option<'0' || option > '3') { cout << endl; cout << endl << "Please Select A Number Between 0 And 2 To Proceed!" << endl << endl; } }while(option < '0' || option > '2'); } void process_Option (); { switch (option) { case '0': cout << endl; cout << "The Program will Now Exit!" << endl << endl; exit(0); break; case '1': Add_New_Customer(); break; case '2': Delete_Customer(); break; default: cout << "Please Select A Number Between 0 And 2 To Proceed!" << endl; } } //Write to a text file void write_File(); { ofstream outFile; outFile.open("customers.txt"); for (int index = 0; index <= Count; index++) { if(index == Count) { outFile << customerList[index].membership_number << ',' <<customerList[index].foreName << ',' << customerList[index].surname << ',' << customerList[index].membership_type << endl; } } cout << "Sucessfully Written to file" << endl; outFile.close(); } void Add_New_Customer(); { bool recordFull = false, found = false; int position = 0, sLength; int membership_number; string forename, surname; char membership_type; if (Count == MAX) { recordFull = true; } if (recordFull == true && Count == MAX) { cout << "Customer File is Full. " << endl; } else { cout << "membership_number: " ;cin >> membership_number; //sLength = membership_number.length(); if(sLength < 4 || sLength > 4) { cout << "Matricno must be exactly 4 digits" << endl; Add_New_Customer(); } //if (membership_number < "1000") { cout << endl << "Membership number must be between 1000 And 9999" << endl; Add_New_Customer(); } //else if(membership_number > "9999") { cout << endl << "Membership number must be between 1000 And 9999" << endl; Add_New_Customer(); } do { if(customerList[position].membership_number == membership_number) { found = true; } else { position++; } if(found == true) { cout << "That membership number Already Existes" << endl; Add_New_Customer(); } } while(position <= (Count+1)); cout <<"Input forename: " ; cin >> forename; cout << "Input surname: " ; cin >> surname; cout << "Input membership type: "; cin >> membership_type; //if (membership_type < 8 || Cred > 15) //{ //cout << "Credit number must be between 8 - 15" << endl; //Add_New_Cistomer(); //} Count = Count + 1; customerList[Count].membership_number = membership_number; customerList[Count].foreName = forename; customerList[Count].surname = surname; customerList[Count].membership_type = membership_type; cout << "New Student Added!" << endl << endl; write_File(); system("pause"); execute_Menu(); } } void Delete_Student(); { cout << "Enter membership_number:" << endl; cout << "Membership Number -> "; cin >> membership_number; //found = linearSearch(customer,membership_number, totalCustomers); if (found!=-1) { recPoint = new Customer; delete recPoint; totalCustomers--; cout << endl << "Customer Record has been deleted." << endl << endl; } else cout << "Record does not exist." << endl << endl; }//End Delete_Student void isempty(); { } void isfull(); { } //void bubblesort(int a[], int membership_number); //{ // int i, j, temp; // // for (i =(membership_number - 1); i > 0; i--) // { // for (j = 1; j <= i; j++) // { // if (a[j-1] > a[j]) // { // temp = a[j-1]; // a[j-1] = a[j]; // a[j] = temp; // } // } // } //} //int binarysearch(int a[], int membership_number, string forename, string surname, char membership_type); //{ // int low=0; // int high=size-1; // int middle; // // while (low <= high) // { // middle = low + (high - low)/2; // find middle of the array // if (searchkey > a[middle]) // if searched number lower than middle value, look after the middle value // low = middle + 1; // else if (searchkey < a[middle]) // high = middle - 1; // else // return middle; // } // return -1; //} //} }
Is This A Good Question/Topic? 0
Replies To: C++ Arraylist
#2
Reputation: 5676
- Posts: 22,537
- Joined: 23-August 08
Re: C++ Arraylist
Posted Today, 10:57 AM
Why did you open a NEW topic?Sigh.
Does it compile? If not, copy and paste the errors into YOUR REPLY. Don't create ANOTHER topic.
#3
Reputation: 980
- Posts: 3,399
- Joined: 19-February 09
Re: C++ Arraylist
Posted Today, 06:04 PM
When defining the body of the function a semicolon is not included after the name.092 void execute_Menu(); // <-- wrong 093 {
Also functions are not created in the main or other functions.
An abstract data type is similar to a class, should ordered list be a class?
You have a Customer struct, you could have a Customer List class.
Page 1 of 1
Source: http://www.dreamincode.net/forums/topic/321739-c-arraylist/
act Google Now Jason Collins White House Correspondents Dinner 2013 NHL playoff schedule Queen of Versailles Nicole Eggert
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.