write a c++ program that reads some numbers from a text file then it displays how many of these numbers composed of the same digit For example(444 22 232 78 1111) so the program should displays 3 (using only while loops and if statment)
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int main() {
int count = 0; // initialize counter
string num;
fstream file;
file.open("data.txt"); // open file
while(file >> num) {
int i = num.length() - 1; // length of num
bool flag = true; // set flag true
while(i != 1) {
if(num[i] != num[i-1]) { // check if all digits are same
flag = false; // if not set flag false and break the loop
break;
}
i--;
}
if(flag) { // count if all digits are same
count++;
}
}
cout << count; // display count
return 0;
}

data.txt:

FOR HELP PLEASE COMMENT.
THANK YOU.
write a c++ program that reads some numbers from a text file then it displays how...
In C write a text analyzer program that reads any text file. The program displays a menu that gives the user the options of counting: • Lines • Words • Characters • Sentences (one or more word ending with a period) • or all of the above Provide a separate function for each option. At the end of the analysis, write an appropriate report.
Write a program that reads the integer numbers in a text file
(numbers.txt) and stores the numbers to a binary file
(binaryNumber.dat). (5 pts)
The number.txt file contains the following numbers:
1 2 3 4 5 6 7 8 9 0
7. Write a program that reads the integer numbers in a text file (numbers.txt) and stores the numbers to a binary file (binaryNumber.dat). (5 pts) The number.txt file contains the following numbers: 1 2 3 4 5 6 7...
Write a program that reads the integer numbers in a text file
(numbers.txt) and stores the numbers to a binary file
(binaryNumber.dat). (5 pts)
The number.txt file contains the following numbers:
1 2 3 4 5 6 7 8 9 0
IN JAVA PLZ
7. Write a program that reads the integer numbers in a text file (numbers.txt) and stores the numbers to a binary file (binaryNumber.dat). (5 pts) The number.txt file contains the following numbers: 1 2 3 4...
Write a program that reads the numbers from the file and totals the numbers. The program should print all the numbers and display the total when all the numbers have been added together. (Warning! The input from the file will be considered a string. Be sure to convert the input to int or float – just as you do when numbers are entered from the keyboard.) numbers.txt has this list of numbers 75 78 91 55 99 85 63 81...
write a C++ program that reads in a text file and reads each character or lexemes and states what token it is and writes to another file for example: while (fahr < upper) a = 23.00 whileend Output: token lexeme -------------------------------- keyword while separator ( identifier fahr operator < identifier upper separator ) identifier a operator = real 23.00 keyword whileend the program aslo reads in comments but does not add to the list. characters that are commented out or...
Write a Java program that reads words from a text file and displays all the non-duplicate words in ascending order. The text file is passed as a command-line argument. Command line argument: test2001.txt Correct output: Words in ascending order... 1mango Salami apple banana boat zebra
Suppose that a text file Lab2.txt contains an unspecified number of scores. Write a program that reads the scores from the file and displays their total and average.In the text file, the scores are separated by blanks.The program should contain two methods with these signatures (it can contain other methods besides these if you think appropriate):public static double totalScores(File inFile)public static double averageScores(File inFile)The output from the program should look like this successful sample run from my solution:The total of...
Write a C++ program that reads a list of numbers 10 and displays largest, second largest and third largest. Note: Please do it with loops don't used arrays
Write a C++ program that reads text from a file and encrypts the file by adding 6 to the ASCII value of each character. See section 5.11 in Starting out with C++ for information on reading and writing to text files. Your program should: 1. Read the provided plain.txt file one line at a time. Because this file has spaces, use getline (see section 3.8). 2. Change each character of the string by adding 6 to it. 3. Write the...
In Python 3, Write a program that reads in a text file that consists of some standard English text. Your program should count the number of occurrences of each letter of the alphabet, and display each letter with its count, in the order of increasing count. What are the six most frequently used letters?