Shrikant
BAN USERShrikant Badiger
Mounz IT Banagalore
- 0of 0 votes
Answerswhite your own printf() function in c ?
- Shrikant in India| Report Duplicate | Flag | PURGE
Abs india pvt. ltd. Developer Program Engineer C
I have done some basic tests with operator overloading and normal operator. I have not found any implication. I have referred to some of the documents related to sequence point and I found the following statement. It might help you to understand.
"The C++11 and C++14 versions of the standard do not formally contain 'sequence points'; operations are 'sequenced before' or 'unsequenced' or 'indeterminately sequenced' instead. The net effect is essentially the same, but the terminology is different."
#include<iostream>
#include<string.h>
#include<stdlib.h>
#include<vector>
using namespace std;
// Function for paired char to store
typedef std::pair<char,char> charPair;
//Vector to hold the paired data
typedef std::vector<charPair> pairedVector;
int main()
{
int number;
cout<<"\n Enter the number of inputs:";
cin>>number;
char inputChar1,inputChar2;
pairedVector dataVector;
for(int i=0;i<number; i++)
{
/* Reading the user string*/
cout<<"\n Enter the paired chars:";
cin>>inputChar1;
cin>>inputChar2;
/* pair the char for insetion*/
charPair p = std::make_pair(inputChar1, inputChar2);
/* Inserting the data into Vector for string pair*/
dataVector.push_back(p);
}
charPair min;
for(int i=0; i< dataVector.size()-1; i++)
{
min=dataVector[i];
int swapIndex=i;
for(int j=i; j<dataVector.size(); j++)
{
if(min>dataVector[j])
{
min=dataVector[j];
swapIndex=j;
}
}
/* Swap the values */
charPair tmp=dataVector[swapIndex];
dataVector[swapIndex]=dataVector[i];
dataVector[i]=tmp;
}
/* Define an iterator to get the values from the vector*/
pairedVector::iterator it;
int i=0;
for( it=dataVector.begin(); it!=dataVector.end(); ++it)
{
cout<<"\n Pair < "<<dataVector[i].first<<","<<dataVector[i].second<<">"<<endl;
++i;
}
return 0;
}
jmp_buf env_buffer;
- Shrikant September 22, 2021val = setjmp( env_buffer );