Click here to Skip to main content
14,659,588 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: [Code Review] [SFML] Simple Breakout/Arkanoid Clone + Asking for some help Pin
David Crow16-Nov-15 2:46
MemberDavid Crow16-Nov-15 2:46 
QuestionWhy my TreeView cannot show icon Pin
joshua013711-Nov-15 23:49
Memberjoshua013711-Nov-15 23:49 
QuestionCalling a URL from an MFC - MDI application Pin
Member 1210848611-Nov-15 18:22
MemberMember 1210848611-Nov-15 18:22 
AnswerRe: Calling a URL from an MFC - MDI application Pin
Richard MacCutchan11-Nov-15 21:17
mveRichard MacCutchan11-Nov-15 21:17 
AnswerRe: Calling a URL from an MFC - MDI application Pin
David Crow12-Nov-15 2:26
MemberDavid Crow12-Nov-15 2:26 
QuestionVS 2010 C++ Debug Pin
Harry_D11-Nov-15 5:02
MemberHarry_D11-Nov-15 5:02 
AnswerRe: VS 2010 C++ Debug Pin
Richard Andrew x6411-Nov-15 6:27
professionalRichard Andrew x6411-Nov-15 6:27 
Questionmemory allocation error Pin
Member 1208345310-Nov-15 20:34
MemberMember 1208345310-Nov-15 20:34 
the code shows std::bad_alloc error dont know what to do about it when remove the push_back it dissapears. please help on what to do. this happens only when I am entering a huge string s else it runs perfectly fine. is there another efficient way to find all the possible substring, arrange them lexicographicaly and then concatinate them back into one string????pls help thnx in advance



#include <cmath>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include<string>
#include <algorithm>

using namespace std;

bool sortByString(string &t1, string &t2)
{
return t1 < t2;
}

int main() {

string s,sub,i,c,q;

int T;
cin>>T;

while(T--){

cin >> s;

int length = s.length();

cin>>q;
vector<string> ss;

for (c = 0; c < length; c++)
{
for (i =length-c;i>=1; i--)
{
ss.push_back(s.substr(c,i));
}
}

s="";

set<string> se(ss.begin(),ss.end());
ss.assign(se.begin(),se.end());

vector<string>::iterator p;

for( p=ss.begin();p!=ss.end();++p)
s.append(*p);

cout<<s[q-1]<<endl;
}

return 0;
}
AnswerRe: memory allocation error Pin
CPallini10-Nov-15 21:54
mveCPallini10-Nov-15 21:54 
GeneralRe: memory allocation error Pin
Member 1208345311-Nov-15 0:28
MemberMember 1208345311-Nov-15 0:28 
GeneralRe: memory allocation error Pin
CPallini11-Nov-15 0:30
mveCPallini11-Nov-15 0:30 
QuestionRe: memory allocation error Pin
David Crow11-Nov-15 2:43
MemberDavid Crow11-Nov-15 2:43 
GeneralRe: memory allocation error Pin
Stefan_Lang13-Nov-15 4:23
mveStefan_Lang13-Nov-15 4:23 
QuestionStandalone Windows Application using Visual C++ and SQL DB is possible? Pin
Member 1212982010-Nov-15 11:36
MemberMember 1212982010-Nov-15 11:36 
AnswerRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
Garth J Lancaster10-Nov-15 12:14
professionalGarth J Lancaster10-Nov-15 12:14 
PraiseRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
David Crow10-Nov-15 14:40
MemberDavid Crow10-Nov-15 14:40 
QuestionRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
David Crow10-Nov-15 14:41
MemberDavid Crow10-Nov-15 14:41 
AnswerRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
Richard MacCutchan10-Nov-15 23:02
mveRichard MacCutchan10-Nov-15 23:02 
GeneralRe: Standalone Windows Application using Visual C++ and SQL DB is possible? Pin
Member 1212982016-Nov-15 11:02
MemberMember 1212982016-Nov-15 11:02 
Questionconverting sound to text software from c++ Pin
Member 121226567-Nov-15 16:47
MemberMember 121226567-Nov-15 16:47 
AnswerRe: converting sound to text software from c++ Pin
Richard MacCutchan7-Nov-15 21:13
mveRichard MacCutchan7-Nov-15 21:13 
QuestionKinect V2 (Converting code written for Xtion pro live to kinect v2 compatible form) Pin
ArsalanSaeed7-Nov-15 12:45
MemberArsalanSaeed7-Nov-15 12:45 
QuestionKinect V2 (Angle detection between 2 joints) Pin
ArsalanSaeed7-Nov-15 12:39
MemberArsalanSaeed7-Nov-15 12:39 
QuestionMFC CListCtrl how to Display SubItem text with tabulator ? Pin
Member 85340357-Nov-15 3:43
MemberMember 85340357-Nov-15 3:43 
AnswerRe: MFC CListCtrl how to Display SubItem text with tabulator ? Pin
Richard MacCutchan7-Nov-15 5:04
mveRichard MacCutchan7-Nov-15 5:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.