how to do the redirection in windows On Sat, Apr 9, 2011 at 8:06 PM, ravi shanker <ravishanker....@gmail.com>wrote:
> Hi Bruno, > > There is an easy way to handle the I/O j > ust use "<" operator to read the value from file and ">" to write back to > file. > example: suppose my executabe name is Demo.exe > > > Demo.exe < input.in > output.out > > > Now when we use cout in your program it will redirect it in the file > output.out in the respective format and the same way > via using cin u r able to read the values from the file. So there is no > need of unnecessary file handling...just focus on the > logic. > > > On Sat, Apr 9, 2011 at 1:15 PM, BrunoOliveira <olivbru...@gmail.com>wrote: > >> Hello fellow programming friends, >> >> I am participating in GCJ for my first time "in an official way". I`m >> from Portugal. >> >> I was able to come up with some of the algorithms necessary to solve >> some problems, such as "Minimum Scalar Product" in Round 1A 2008. >> >> However, I never got to submit a solution because I can`t handle my I/ >> O operations with files as I can“t "generalize" my core algorithm to >> all the test cases... Can you give me a few pointers? >> >> My code for the above problem was: >> >> #include <iostream> >> #include <vector> >> #include <algorithm> >> using namespace std; >> >> void min_scalar_product(vector<int> &v1, vector<int> &v2) >> { >> sort(v1.begin(), v1.end()); >> sort(v2.begin(), v2.end()); >> >> int min = 0; >> >> for(int i = 0; i < v1.size(); i++) >> { >> min += v1[i]*v2[v1.size()-(i+1)]; >> } >> cout << min; >> } >> >> int main() >> { >> int nums1[] = {1,3,-5}; >> vector<int> v1; >> v1.assign(nums1, nums1+sizeof(nums1)); >> >> int nums2[] = {2,4,-10}; >> vector<int> v2; >> v2.assign >> return 0; >> } >> >> Can you please help me and also, give me some ideas regarding my >> coding style? >> >> Thank you in advance, >> Bruno (username Pardal) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "google-codejam" group. >> To post to this group, send email to google-code@googlegroups.com. >> To unsubscribe from this group, send email to >> google-code+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/google-code?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "google-codejam" group. > To post to this group, send email to google-code@googlegroups.com. > To unsubscribe from this group, send email to > google-code+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.