第十六周任务(一)

#include <iostream>
#include <fstream>
using namespace std;
int main() 
{	
	double a[500],t;
	int j,i=0;
	ifstream readFile;
	ofstream writeFile;
	readFile.open("salary.txt", ios::in);
	if(!readFile)
	{
		cerr<<"open error"<<endl;
		exit(1);
	}

	writeFile.open("ordered_salary.txt", ios::out);
	if(!writeFile)
	{   
		cerr<<"open error"<<endl;
		exit(1);
	}
	while(i<500)
	{
		readFile >>a[i];
		i=i+1;
	}
	readFile.close();
	for(int i=0;i<500;i++)
	{
		a[i]=a[i]+100;
	}
	

	for(int j=0;j<500-2;j++)
	{
		for(int i=0;i<499-j;i++)
			if(a[i]<a[i+1])
			{
				t=a[i];
				a[i]=a[i+1];
				a[i+1]=t;
			}
	}
	while(i<500)
	{
		writeFile<<  a[i] <<endl;
	}
	writeFile.close();
	cout << "Finish!" << endl;
	system("pause");
	return 0;
}
3085.84
3084.95
3082.7
3081.5
3068.97
3062.72
3058.93
3058.17
3047.46
3045.1
3040.78
3034.8
3030.51
3019.21
3014.69
3012.41
3009.22
3006.93
3006.75
3005.76
3004.98
2990.26
2986.68
2985.38
2979.14
2975.25
2974.9
2961.65
2957.6
2954.6
2951.86
2946.23
2941.68
2939.73
2938.8
2936.74
2935.94
2932.47
2931.31
2927.11
2922.33
2916.2
2915.13
2914.89
2909.59
2909.58
2898.32
2892.31
2887.2
2877.54
2873.98
2872.85
2872.59
2867.94
2845.52
2843.18
2841.95
2839.34
2838.9
2835.2
2817.51
2816.12
2814.84
2811.12
2809.33
2808.74
2805.8
2804.35
2802.7
2800.53
2773.31
2769.59
2766.2
2756
2750.92
2748.55
2741.32
2740.22
2738.86
2729.71
2727.62
2727.47
2726.1
2720.87
2720.15
2707.83
2700.42
2680.97
2664.65
2660.7
2654.82
2651.5
2650.13
2644.43
2640.76
2638.14
2636.18
2630.81
2621.74
2620.23
2613.58
2607.35
2604.25
2597.9
2595.5
2591.6
2587.88
2578.74
2557.61
2550.49
2546.31
2541.1
2539.71
2534.72
2534.65
2524.46
2516.17
2510.92
2509.58
2500.2
2498.59
2491
2490.4
2486.22
2484.95
2483.71
2476.48
2475.89
2469.1
2460.12
2459.4
2459.26
2449.14
2446.91
2444.9
2441.73
2440.57
2434.86
2425.6
2410.37
2408.74
2406
2392.62
2392.48
2377.5
2365.7
2358.94
2352.79
2349.5
2340.99
2333.84
2326.63
2321.71
2311.9
2306.63
2303.48
2294.15
2292.81
2287.4
2283.8
2278.65
2270.71
2262.98
2261.6
2258.61
2252.61
2252.35
2249.21
2245.99
2245.54
2245.1
2244.4
2243.46
2238.85
2224.58
2221.39
2218.2
2212.3
2206.57
2202.63
2202.52
2192.66
2185.27
2184.51
2180.98
2171.62
2165.6
2152.36
2148.96
2147.84
2141.49
2137.31
2129.45
2127.8
2126.19
2119.3
2111.1
2109.47
2101.91
2090.59
2090.25
2084.87
2080.74
2074.22
2071.24
2055.57
2052.96
2046.68
2046.62
2042.62
2039.63
2038.33
2034.49
2006.4
2004.86
2004.57
2003.66
2000.84
2000.77
1995.55
1993.97
1992.87
1987.33
1986.9
1986.45
1985.23
1974.49
1972.97
1970.13
1969.9
1964.86
1954.94
1948.92
1948.4
1943.52
1942.54
1935.38
1926.21
1922.32
1921.47
1910.68
1910.6
1900.54
1895.2
1892.99
1884.22
1882.77
1868.74
1865.32
1863.34
1860.89
1860.42
1855.86
1848.4
1841.93
1829.38
1818.82
1811.96
1807.79
1807.64
1796.38
1788.42
1787.41
1780.9
1779.8
1775.24
1764.4
1763.38
1759.35
1758.92
1752.41
1748.4
1746.94
1746.79
1741.16
1739.24
1738.25
1736.8
1728.1
1721.71
1713.66
1708.76
1708.52
1705.55
1704.15
1699.24
1697.74
1691.71
1679.13
1678.49
1676.12
1668.5
1664.16
1662.86
1658.9
1629.37
1629.11
1625.74
1622.4
1615.47
1606.61
1596.64
1595.6
1589.57
1588.51
1559.25
1557.61
1549.49
1546.58
1540.24
1532.14
1523.2
1504.53
1501.49
1499.35
1487.96
1485.12
1460.18
1458.76
1449.45
1448.9
1446.39
1436.68
1432.45
1429.64
1427.6
1426.63
1426.54
1424.28
1413.75
1411.32
1409.49
1406.81
1398.99
1397.42
1396.38
1390.2
1387.69
1380.23
1368.82
1367.37
1365.45
1354.64
1354.24
1345.72
1339.96
1336.46
1331.82
1331.26
1328.94
1328
1322.8
1320.87
1313.95
1307.1
1299.42
1297.41
1294.94
1294.8
1294.68
1290.11
1287.33
1281.16
1280.6
1270.91
1268.84
1266.78
1263.87
1247.89
1245.34
1245.24
1243.64
1236.91
1232.66
1219.57
1218.11
1215.63
1215.57
1215.36
1212.86
1203.17
1199.51
1191.78
1191.62
1182.87
1172.8
1169.9
1168.69
1166.63
1161.66
1150.54
1145.9
1134.7
1126.28
1124.76
1113.89
1111.89
1106.2
1105.74
1105.61
1105.34
1103.43
1103.34
1098.22
1093.84
1085.94
1080.55
1078.89
1075.23
1072.92
1072.81
1062.57
1062.4
1062.11
1055.71
1055.17
1050.45
1049.99
1040.34
1038.28
1028.37
1009.68
1009.41
1006.43
1002.29
1001.26
999.71
997.91
995.16
981.12
976.95
972.61
964.92
962.85
962.48
962.27
958.74
953.4
951.57
950.81
950.4
945.14
944.49
933.42
932.11
931.39
931.11
928.64
925.9
917.2
904.2
902.77
892.32
891.95
882.3
879.92
878.31
873.56
871.3
863.77
857.65
848.5
846.5
841.9
829.15
828.13
823.49
810.45
805.92
799.68
795.48
794.8
788.48
781.29
780.8
778.67
766.83
748.86
743.84
740.75
734.22
722.48
719.54
714.22
713.3
711.29
699.77
696.16
692.22
689.97
689.43
685.25
673.1
672.72
660.24
654.3
653.65
648.71
644.67
634.43
阅读更多
文章标签: 任务 include ios
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭