Sponsored Content
Top Forums Shell Programming and Scripting Why the results of these two code fragments are not the same? Post 303030166 by johnprogrammer on Wednesday 6th of February 2019 11:09:03 PM
Old 02-07-2019
The POSIX shell code detects if there are two or more, same command line arguments to the script.


An example with C++03.

Assuming we have a vector (array) with some strings:

Code:
#include <iostream>
#include <string>
#include <vector>


int main()
{
  using namespace std;

  string stringArray[]={"some", "to", "words", "to", "use", "for", "testing", "purposes"};

  vector<string> myvector(stringArray, stringArray+ sizeof(stringArray)/sizeof(*stringArray) );


  Here is the interesting part:

  for(vector<string>::size_type i= 0; i< myvector.size(); ++i)
  {
    for(vector<string>::size_type j= i+ 1; j< myvector.size(); ++j)
    {
       if(myvector[j]== myvector[i])
       {
         cout<< "Two or more words are the same\n\n";
         
         return 0;
       }
    }
  }

}

This is what I am trying to do with the POSIX shell code I posted.
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

fragments in Solaris 8

When discussing inodes and data blocks, I know Solaris creates these data blocks with a total size of 8192b, divided into eight 1024b "fragments." It stores data in "contiguous" fragments and solaris doesn't allow a file to use portions of two different fragments. If the file size permits, then the... (4 Replies)
Discussion started by: manderson19
4 Replies

2. Post Here to Contact Site Administrators and Moderators

results survey

Hi guys! I was wondering what the outcome was of your survey of a few months ago? One of the questions was if people were willing to pay for additional services like an own account, like username@unix.com with mail box, etc. Sorry if I missed the results if you had already posted them. Ivo (1 Reply)
Discussion started by: Ivo
1 Replies

3. Solaris

ipfilter blocking ip fragments

For some reason ipfilter is blocking inbound fragmented ip packets (the packets are larger than the interface's MTU) that are encapsulating UDP segments. The connection works, so I know ipfilter is letting some traffic through, it is just a lot slower than it should be. Rules that allow the... (3 Replies)
Discussion started by: ilikecows
3 Replies

4. IP Networking

Solaris 11 Express NAT/Router IP Fragments

Upon replacing my linux router/server with a Solaris one I've noticed very poor network performance. The server itself has no issues connecting to the net, but clients using the server as a router are getting a lot of IP fragments as indicated from some packet sniffing I conducted. Here was my... (3 Replies)
Discussion started by: vectox
3 Replies

5. Shell Programming and Scripting

Can ctag and cscope support recording search results and displaying the history results ?

Hello , When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
Discussion started by: 915086731
0 Replies

6. Shell Programming and Scripting

Why use different FS, the results is different?

# echo '1 2 3 ' | awk -F' ' '{print NF}' 3 # echo '1:2:3:' | awk -F':' '{print NF}' 4 (1 Reply)
Discussion started by: lazycat79
1 Replies

7. Shell Programming and Scripting

Extract fragments from file

I have a .xml file that looks something like this : <measInfo> ......... string1 ......... </measInfo> <measInfo> ...... string2 ........ </measInfo> I want to extract only the 'chunk of file' from '<measInfo>' to '</measInfo>' containing string1 (or a certain string that I... (13 Replies)
Discussion started by: black_fender
13 Replies

8. Shell Programming and Scripting

I want to add a variable for the results from the formula of one variable and results of another var

Good morning all, This is the file name in question OD_Orders_2019-02-19.csv I am trying to create a bash script to read into files with yesterdays date on the file name while retaining the rest of the files name. I would like for $y to equal, the name of the file with a formula output with... (2 Replies)
Discussion started by: Ibrahim A
2 Replies
std::tr2::__dynamic_bitset_base< _WordT, _Alloc >(3cxx) 				   std::tr2::__dynamic_bitset_base< _WordT, _Alloc >(3cxx)

NAME
std::tr2::__dynamic_bitset_base< _WordT, _Alloc > - SYNOPSIS
Inherited by std::tr2::dynamic_bitset< _WordT, _Alloc > [private]. Public Types typedef _Alloc allocator_type typedef _WordT block_type typedef size_t size_type Public Member Functions __dynamic_bitset_base (const allocator_type &__alloc=allocator_type()) __dynamic_bitset_base (__dynamic_bitset_base &&__b) __dynamic_bitset_base (size_type __nbits, unsigned long long __val=0ULL, const allocator_type &__alloc=allocator_type()) size_t _M_are_all_aux () const void _M_assign (const __dynamic_bitset_base &__b) void _M_clear () void _M_do_and (const __dynamic_bitset_base &__x) void _M_do_append_block (block_type __block, size_type __pos) size_t _M_do_count () const void _M_do_dif (const __dynamic_bitset_base &__x) size_type _M_do_find_first (size_t __not_found) const size_type _M_do_find_next (size_t __prev, size_t __not_found) const void _M_do_flip () void _M_do_left_shift (size_t __shift) void _M_do_or (const __dynamic_bitset_base &__x) void _M_do_reset () void _M_do_right_shift (size_t __shift) void _M_do_set () unsigned long long _M_do_to_ullong () const unsigned long _M_do_to_ulong () const void _M_do_xor (const __dynamic_bitset_base &__x) allocator_type _M_get_allocator () const block_type & _M_getword (size_type __pos) block_type _M_getword (size_type __pos) const block_type & _M_hiword () block_type _M_hiword () const bool _M_is_any () const bool _M_is_equal (const __dynamic_bitset_base &__x) const bool _M_is_less (const __dynamic_bitset_base &__x) const bool _M_is_proper_subset_of (const __dynamic_bitset_base &__b) const bool _M_is_subset_of (const __dynamic_bitset_base &__b) void _M_resize (size_t __nbits, bool __value) size_type _M_size () const void _M_swap (__dynamic_bitset_base &__b) Static Public Member Functions static block_type _S_maskbit (size_type __pos) static size_type _S_whichbit (size_type __pos) static size_type _S_whichbyte (size_type __pos) static size_type _S_whichword (size_type __pos) Public Attributes std::vector< block_type, allocator_type > _M_w" Static Public Attributes static const size_type _S_bits_per_block static const size_type npos Detailed Description template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>>struct std::tr2::__dynamic_bitset_base< _WordT, _Alloc > Base class, general case. See documentation for dynamic_bitset. Definition at line 81 of file dynamic_bitset. Member Data Documentation template<typename _WordT = unsigned long long, typename _Alloc = std::allocator<_WordT>> std::vector<block_type, allocator_type> std::tr2::__dynamic_bitset_base< _WordT, _Alloc >::_M_w 0 is the least significant word. Definition at line 94 of file dynamic_bitset. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Sun Jan 6 2013 std::tr2::__dynamic_bitset_base< _WordT, _Alloc >(3cxx)
All times are GMT -4. The time now is 03:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy