So I have been taking a break from posting and writing in C++, and switched to python. Unless you are using C or C++ for a reason, then you should switch too, and here is why...
Python: 60 seconds
C++: 4 minutes
Witch one did you think took longer to write?
LOL,
-Tristan
Python: 60 seconds
#document reader for python 2.7 in windows
import os
fname = raw_input("Please enter a file name: ")
os.system("cls")
file1 = open(fname, "r+b")
fileinput = file1.read()
print fileinput
C++: 4 minutes
#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
using namespace std;
int main()
{
cout << "Enter a file name to read: ";
string fname
cin >> fname;
system("cls");
ifstream readfile;
readfile.open(fname);
string data;
readfile >> data;
cout << data;
}
Witch one did you think took longer to write?
LOL,
-Tristan
0 Comments On This Entry
Trackbacks for this entry [ Trackback URL ]
← January 2022 →
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 |
Tags
My Blog Links
Recent Entries
-
-
Python worm?on Jun 27 2013 09:21 AM
-
-
-
back from break, well sort of...on Jul 10 2012 07:59 AM
Search My Blog
4 user(s) viewing
4 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)



Leave Comment









|