-
Notifications
You must be signed in to change notification settings - Fork 0
/
RawLargerThanN.cpp
50 lines (44 loc) · 1013 Bytes
/
RawLargerThanN.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//CSC114-651
//Student: Christopher Yonek (700642859)
//Assignment: Read a number from a textfile and print out a list larger than N.
//Date: October 2018
#include "pch.h"
#include <iostream>
#include <conio.h>
#include <fstream>
using namespace std;
void showValues(int[], int,int);
int main(){
const int ARRAY_SIZE = 250;
int input_n, count = 0, newSize;
int numbers[ARRAY_SIZE];
ifstream inputFile;
inputFile.open("C:/Users/sides/Documents/College Papers/Computer Science/cstuff/HW8.txt");
while (!inputFile.eof())
{
inputFile >> numbers[count];
count++;
}
newSize = count;
cout << "Enter a value for n: \n";
cin >> input_n;
cout << "These are the values larger than n:\n\n";
showValues(numbers, ARRAY_SIZE,input_n);
_getch();
return 0;
}
void showValues(int nums[], int size, int n)
{
if (n == -1)
{
exit(0);
}
for (int index = 0; index < size; index++)
{
if (nums[index] > n)
{
cout << nums[index] << " ";
cout << endl;
}
}
}