Hello everybody! I'm trying to count the number of occurrences of each word in a text file. Problem situation requires to realize menu using "switch" statement (If file exist or not). There are following errors in my program ("case b" and "default" is not working): **[C++ Error] 03_int.cpp(61): E2126 Case bypasses initialization of a local variable [C++ Error] 03_int.cpp(72): E2238 Multiple declaration for 'w' [C++ Error] 03_int.cpp(50): E2344 Earlier declaration of 'w' [C++ Error] 03_int.cpp(83): E2126 Case bypasses initialization of a local variable** #include <fstream.h> #include <iostream.h> #include <map.h> #include <string> #include <cstdlib> #include <iomanip> #include <conio.h> typedef std::map<std::string, int> …

Member Avatar
Member Avatar
+0 forum 8

Hello funs2code! I have the following problem. I need to count the number of occurrences of a concrete word in a text file. I've tried to count the number of occurrences of each word at first. The following code has no errors but it isn't working! When I type in a command line "project1.exe test.dat cat dog cat dog" the empty string is showed. I've cheked if-statements -> right working. Then I've made a conclusion that problem is in for-statement (with iterators). Can anyone explain me, guys? #include <iostream.h> #include <fstream.h> #include <map.h> #include <string.h> #include <iterator.h> typedef std::map<std::string, int> …

Member Avatar
Member Avatar
+0 forum 5

Write a complete C++ program that reads the attached file (values.txt) to find and print the following: a. The average value of the numbers in the file. b. The maximum and minimum value c. The count of negative and positive values (ignore zero) #include <iostream> #include<fstream> using namespace std; int main() { int count=0,poscount=0,negcount=0; double avg,max=-9999999,min=9999999,num,sum=0; ifstream inputFile("values.txt"); // input stream to read contents of input file while(inputFile>>num) { sum=sum+num; count++; if (num>max) { max=num; } if (num<min) { min=num; } if (num>0) { poscount++; } if (num<0) { negcount++; } } avg=(sum/count); cout<<" The average value of the numbers …

Member Avatar
Member Avatar
+0 forum 1

1. For all the accounts that have authority="admin", set permision to modify all of the files (attribute changes is datatype YES/NO),,, so basically a user can set yes or no depends on his will. 3. For each directory, print out his name, in which directory it is located, and how many subdirectories does it have. It is necessary to print out those directories which aren t found in a directory(don t have parentdirectories) and those whith no subdirectories 5. Find 10% of the largest directories wich do not have subdirectories. The size of the directory without the subdirectory is equal …

Member Avatar
Member Avatar
+0 forum 2

hello. I need some help on our implementation on lines of code program. here's the algorithm we have: 1. The LOC program will start by asking for the filename of the program to be counted. 2. Browse for the filename of the program to be used. 3. The contents of the file will be stored to a temporary storage. 4. Declare a count variable and initialize it to zero. 5. Read the code line by line. 6. If there is at least one character in a line, the count variable will be incremented. 7. Display the contents of the count …

Member Avatar
Member Avatar
+0 forum 10

Hi all, I need to do my own version of phpMyAdmin for my php class. I encountered problem when trying modify existing data on database. I don't know what would be best way to modify whole table's data when I don't know exact amount of rows or columns. At this point I list existing table to <input type=text> and have also hidden inputs for delivering data to my updater php file. But what would be best way to actually update data to database. Do I just loop through all data and update it one by one or in a one …

Member Avatar
Member Avatar
+0 forum 4

Hi Guys, How's your day? I would like to ask, since I'm a beginner in vb .net, I can't figure this out. Here's the scenario: I have a folder with lots of folders inside and inside those folders are .tif files. I want to create a program that will rename those images based from the list from my text file. Here's the content of my text file: Filename: woutbar.txt Code: [CODE] 1.tif 2.tif 2_001.tif 3.tif 3_001.tif 4.tif 4_001.tif 5.tif 5_001.tif 6.tif 6_001.tif 7.tif 7_001.tif 8.tif 8_001.tif[/CODE] Filename: withbar.txt Code: [CODE] 1.tif 1_001.tif 2.tif 2_001.tif 3.tif 3_001.tif 4.tif 4_001.tif 5.tif 5_001.tif …

Member Avatar
Member Avatar
+0 forum 10

The End.