Hi guys, i'm new at C++ and i'm currently learning how to integrate functions to read consecutive integers off a .txt file.
This is the part I DON'T get. Basically I have a function to detect a palindrome number, but how do i get it to be used to read an external .txt file? I listed the function before the main() . But where do i put the file stream and how do i link it to read the .txt file on my desktop?
Reading the numbers and checking if they are palindromes are 2 totally different things.
I would declare the input stream in main, read the numbers in a loop and call the function for palindromes on each number.
Hi andy, I was more looking for a general understanding of the concept, but here is my code.
Basically I have a function to check if a number is a palindrome, and i am supposed to run a list of numbers from a .txt file through this function. in the end results its supposed to print out how many numbers are palindromes and how many are not. My code is still incomplete of course but any advice will be very helpful thanks!
using namespace std;
bool numberPalindrome(int x)
int palinDrome = 0, notPalinDrome = 0;
int y, r = 0;