sometimes when I run my program the exe window just appears for a sec and disappears.Is there any particular cause for this?
One of those programs is written here.
#include<iostream>
#include<string>
using namespace std;
int main()
{

int i;
string s;
for(i=0; ;i++)
{s=i;}
int n=s.length();
cout<<s[n]<<endl;
system("pause");
return 0;
}

Try making the process wait for an input character by using say getchar() or std::cin.get()

Also, using system("pause") is not such a good idea:

http://www.gidnetwork.com/b-61.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.