PSUDOCODE:
START
READ s;
OPEN FILE s
SET c=0
SET vector<int> v;
while(!f.eof())
f>>c;
v.push_back(c);
end while
sort vector v
print vector v
end for
STOP
CODE:
#include<fstream>
#include<iostream>
#include<string.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
ifstream f;
char s[100];
cin>>s;
char d;
f.open(s);
int c=0;
int count=0;
vector<int> v;
while(!f.eof())
{
f>>c;
v.push_back(c);
}
sort(v.begin(),v.end());
for(c=0;c<v.size();c++)
{
cout<<v[c]<<endl;
}
return 0;
}
START
READ s;
OPEN FILE s
SET c=0
SET vector<int> v;
while(!f.eof())
f>>c;
v.push_back(c);
end while
sort vector v
print vector v
end for
STOP
CODE:
#include<fstream>
#include<iostream>
#include<string.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
ifstream f;
char s[100];
cin>>s;
char d;
f.open(s);
int c=0;
int count=0;
vector<int> v;
while(!f.eof())
{
f>>c;
v.push_back(c);
}
sort(v.begin(),v.end());
for(c=0;c<v.size();c++)
{
cout<<v[c]<<endl;
}
return 0;
}
No comments:
Post a Comment