c++ - How to adjust this bubble sort -
The problem at this time is that this program only works by typing in the name of the text file.
I am told that where he has gone to reduce it, where it simply opens the right text file with the bat and sorts the bubbles with it (which is in its present state).
Example of text file:
-14, -5, 7, 1, 7, 71, -3, 59 [Bubble abbreviation] -14, -5, -3, 1, 7, 7, 59, 71
#include "stdafx.h" #include & lt; Iostream & gt; # Include & lt; Fstream & gt; #include & lt; String & gt; # Include & lt; Iomanip & gt; # Include & lt; Cstdlib & gt; #include & lt; Vector & gt; using namespace std; Zero Babsport (Ent Ar []); Int main () {string file; Const int = 100, b = 10, c = 10; Int count = 0, count1 = 0, d = 0, swap = 0; Int clam [A] = {0}, r [b] [c] = {0}; Cout & lt; & Lt; "File type name:" & lt; & Lt; Endl; Cin & gt; & Gt; File; Ifstream data; Data.open (file); Of vector & lt; Int & gt; Array; Int number; Whereas (data> gt; & gt; number); {Array.push_back (number); Count ++; D = calculation; Clam [count]; } Data. Close (); Data.open (file); While (data.good ()) {int i; (I = 0; i & lt; d; i ++) for {data & gt; & Gt; Clam [i]; Cout & lt; & Lt; Clam [i] & lt; & Lt; ""; Count1 ++; }} Cout & lt; & Lt; Andal & lt; & Lt; "In it" & lt; & Lt; D & lt; & Lt; "Within Integer" & lt; & Lt; '' '& Lt; & Lt; File & lt; & Lt; & gt; '' & Lt; & Lt; "File!" & Lt; & Lt; Endl; Data.close (); (Int k = 0; k & lt; = count - 1; k ++) {for (int l = k + 1; l clam [l]) {temp = clam [k]; Clam [K] = Clam [L]; Clam [l] = temporary; Swap ++; }}} Cout & lt; & Lt; Andal & lt; & Lt; "This trimmer" & lt; & Lt; Swap & lt; & Lt; "Swap #" & lt; & Lt; Endl; Data.close (); Cout & lt; & Lt; Endl; (Int y = 0; y & lt; count; y ++) {for (int z = 0; z It does not seem to change the name of the Infilefile function, I do not know how to tweak it.
get rid of the bus:
cout & lt; & Lt; "File type name:" & lt; & Lt; Endl; Cin & gt; & Gt; File; Change your and file to your definition of: string file = "filename.txt";
Comments
Post a Comment