Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 15-03-2010
Member
 
Join Date: Jan 2010
Posts: 22
Use of the back() in C++

Hello, I am studying in the ABC college. I had just started to learn C++ language from the institute. I am interested in the programming and I had heard that the C++ language can be the very simple programming language. So, I would like to know about the back() function of the C++ language. Also, I would like to know about the use of the back() function in the C++ programming. Can anyone has the solution for me on the back() function. Reply Me!!!
Reply With Quote
  #2  
Old 15-03-2010
Member
 
Join Date: May 2008
Posts: 2,383
Re: Use of the back() in C++

The back() function can be used to execute the last element in the given specified queue. The back() function can returns a address to the last element in the given specified queue. That can be the newest element in the given specified queue that is the last element that can be pushed into the queue. The back() function of the C++ language can be the member function of the queue.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #3  
Old 15-03-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Use of the back() in C++

The program that can be mentioned below illustrates you about how to use the back() function in the C++ language programming :
Code:
#include <iostream>
#include <queue>
using namespace std;
int main ()
{
  queue<int> mque;
  mque.push(12);
  mque.push(75);   
  mque.back() -= mque.front();
  cout << "mque.back() is now " << mque.back() << endl;
  return 0;
}
Output:
Code:
mque.back() is now 63
Reply With Quote
  #4  
Old 15-03-2010
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: Use of the back() in C++

The back() function can be used to give the address of the last element that can be in the given specified queue. The back() function can be the member type value_type and that can be specified to the type of value consisted by the belonging class, that shall be the similar as the first template parameter (S). The back() function can be the member function of the queue class of the C++ language.
Reply With Quote
  #5  
Old 15-03-2010
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Use of the back() in C++

The back() function can returns a address to the last element that can be in the given specified queue. For an example:
Code:
  queue<int> p;
   for( int j = 0; j < 5; j++ ) 
   {
     p.push(j);
   }
   cout << "The first element is " << p.front()
        << " and the last element is " << p.back() << endl;
This code produces the following output:
Code:
   The first element is 0 and the last element is 4
The back() function can be executed in the constant time.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Use of the back() in C++"
Thread Thread Starter Forum Replies Last Post
How do I go back to IE7, I have IE8 Techmates Technology & Internet 4 15-03-2011 02:46 AM
Help me get back to AMD: Phenom x6 Marjorie Motherboard Processor & RAM 5 16-09-2010 03:52 AM
Poor IPERF file transfer performance between two back-to-back Windows 7 Dell laptops Madhuparna Networking & Security 5 07-09-2010 12:01 AM
Back to SP2 Darth Operating Systems 2 11-11-2008 06:03 PM


All times are GMT +5.5. The time now is 06:04 PM.