hi, i am trying to read from a text file and store the data in an array but i don't know how to get started with my code. can someone please get me started here. i have start with the code for locating the file, but i am having difficulty reading the file. Dim strFileName As String OpenAnswerFile.ShowDialog() strFileName = OpenAnswerFile.FileName MessageBox.Show(strFileName) 'message box showing the file path

Member Avatar
Member Avatar
+0 forum 13

I am using Mplab x Ide with v3.61 on Xc8 compiler, PIC18F24K40. I used MCC generated UART code for send and receive data. For understanding I am clubling my code and posting part of it. My main code look like this #include "mcc_generated_files/mcc.h" #define EUSART_TX_BUFFER_SIZE 8 #define EUSART_RX_BUFFER_SIZE 8 /** Section: Global Variables */ volatile uint8_t eusartTxHead = 0; volatile uint8_t eusartTxTail = 0; volatile uint8_t eusartTxBuffer[EUSART_TX_BUFFER_SIZE]; volatile uint8_t eusartTxBufferRemaining; volatile uint8_t eusartRxHead = 0; volatile uint8_t eusartRxTail = 0; volatile uint8_t eusartRxBuffer[EUSART_RX_BUFFER_SIZE]; volatile uint8_t eusartRxCount; #define LED_RX RC7 // Pin assigned RX LED #define LED_TX RC6 // Pin assigned …

Member Avatar
Member Avatar
+0 forum 2

i have a problem that i cant figure out how to solve it taht involves mips assembly. I need to ask the user for how many string they want to sort and then loop that many times and store all those strings in an array. I know how to ask for howmany strings they want to enter. I do not know how to store the data into the array and i do not know how to to print the data inside the array. Can anyone help me with this one?

Member Avatar
Member Avatar
-1 forum 1

I am writing a program using J2ME and my goal is to count how many times each character appears in a string. I am not very good at java so the way i see i should do this is create 2 arrays. First array is used to hold characters. Second array is used to keep count The program goes through checks if the first character of the string is in the first array. If it isn't, then put it in the first position in the array and add 1 to its count in the second array. This loops through until …

Member Avatar
Member Avatar
+0 forum 4

i'm working on visual studio 2008. I'm trying use fopen to open txt files and it does not give any errors but its not doing the required task either. i've to submit this project on monday! please help here's part of the code: [CODE]#include <stdio.h> #include<iostream> #include <conio.h> #include <string> #include <stdlib.h> #include<dos.h> using namespace std; FILE *file_ptr; node* treefromfile() { node *ptree=NULL; char word[20],meaning[100],str[120],*i; int flags=0; file_ptr=fopen("C:\Dictionary","r"); if(file_ptr==NULL) ptree=NULL; else { while(!feof(file_ptr)) { i=fgets(str,120,file_ptr); if(i==NULL) break; seperateword(str,word,meaning); if(flags==0) { ptree=maketree(word,meaning); flags=1; } else addword(ptree,word,meaning); }[/CODE]

Member Avatar
Member Avatar
+0 forum 7

I'm wondering if someone can help me figure out my getAverageLength method in the following code: [CODE]package com.abc.text; public class StringProcessing { /** * Returns the number of non-null strings in the set. * If null or a zero-length array is passed in, then zero is returned. * If a slot in the array is null, then it is ignored (not counted). */ public static int getCount(String[] set) { int stringCounter = 0; if (set == null || set.length == 0) { return 0; } else { for (int a = 0; a < set.length; a++) { if (set[a] == …

Member Avatar
Member Avatar
+0 forum 8

Im still learning C and I have a few questions about making a array of strings. Im doing an assignment for school, and I'm a little stuck with my program. Here is my code so far: [CODE] #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]){ FILE* fin; int a; char myString[3];; fin=fopen(argv[1],"r"); fscanf((fin,"%s", &myString)!=EOF); putchar('\n'); printf("%s\n", myString); return 0; } [/CODE] What I am trying to accomplish is to create a program that will take individual characters from a file, each on a separate line, and compose them into a single string in memory while keeping the first character …

Member Avatar
Member Avatar
+0 forum 7

I need help with a programing assignment for my CS 2 class, the task is to check rather a user inputted string is a palindrome meaning it is the same forwards as it is backwards. I have most of the program working, I input a string then copy it and reverse it and I got to the part were I need to compare the reversed string with the original and am getting an error message I don't understand. Here is my code so far: [CODE] #include<iostream> #include<cstdlib> #include<string> using namespace std; //class implimentations. //****************************************************************************** class pstring { private: string testString; …

Member Avatar
Member Avatar
+0 forum 8

Hi ~ Before posting my code, can someone tell me if it is possible to do a dual sort on an array of chars and an array of int, double or float? Would you have to use two separate sorts? Really confused here. I am trying to sort an array of 12 doubles (user input) so that the console output sorts it in descending order. The corresponding months should be printed as well. Thanks for any help! Super lost on this one. :?: ps - Have a separate function for both arrays. The functions are called in main.

Member Avatar
Member Avatar
+0 forum 5

Hello, Working on my final project for a Java Class and have become stumped on the final leg of the code. We are supposed to create a program to add a record, remove a record, display a record, and list all records. The records must be written to a file. I have all of it working except the file part. I am able to get the program to write my array, (Which is what I am using to store and manipulate the records during program running), but I am having trouble getting it to read in the contents Back into …

Member Avatar
Member Avatar
+0 forum 6

I am making a page which pulls from the user's browser their preferred language, via the Request.UserLanguages....which returns a two letter code (ex. "en") or detailed code (ex. "en-GB"). I basically get the string of user languages (they are in order of preference) and store them in a string array. Then I use a loop to check if the language code in the first position of the string array is any of the codes for a certain language (another string array hard coded in). Is there a better way to do this? I'm noticing increased load time and am worried …

Member Avatar
Member Avatar
+0 forum 2

My program is having an error on the following lines w/ red font. It says invalid types 'int[int]' for array subscript... pls help I'm not sure how to solve this. [COLOR="Green"]*********This is actually how my program works********* Read in a line of text and output the number of words in the line and the number of occurrence of each letter. Output the letters in alphabetical order (e.g) I say Hi. Should produce output similar to the ffg: 3 words 1 a 1 h 2 i 1 s 1 y i SAY hI Before asking for the choices the user should …

Member Avatar
Member Avatar
+0 forum 4

I don't fully understand what is wrong with my code, it will read the first lines of any text file but then overloads and keeps displaying "0.00" and then crashes the program. I'm trying to get it to read student's last names and read their GPA scores, and the sentinel value is 99.9, Please help. [CODE]#include <iostream> #include <iomanip> #include <fstream> using namespace std; int main() { //Declare i/o variables ifstream inputFile; //Declare counters int counter = 0; //Declare Arrays char dataFile[20] = {""}; string studentLastName[100] = {""}; float studentGPA[100] = {0.0, }; cout << "Filename: "; cin >> dataFile; …

Member Avatar
Member Avatar
+0 forum 5

I was trying to input an array of strings using pointers but failed. Here is the code: [CODE=C]int i=0; char *p[6]; //array of strings for(i=0;i<5;i++) { gets(p[i]); // input string } for (i=0;p[i];i++){ printf(p[i]); // print string printf("\n"); }[/CODE] The problem is that each time the first for loop executes, i input string from console, but p[i] shows to contain NULL only. It does not contain the strings that I enter from console. The second loop does not execute, simply jumps out of the loop at first iteration since p[0] (and p[1], p[2] so on may be) contains NUll. Where …

Member Avatar
Member Avatar
+0 forum 4

Hiya, A short while ago, I posted the following code snippet in reply to someone who was looking to make a simple encoded password... See here for a full explanation of how this works -->[URL="http://www.daniweb.com/forums/post1470261.html#post1470261"]http://www.daniweb.com/forums/post1470261.html#post1470261[/URL]. While this method is a little cumbersome, it does work and can be encoded and decoded the same on any PC so long as the program version is the same. Well, that's all fine, but what if you wanted to grease the cogs a bit and stop it from churning through hundreds of textboxes everytime it has to go converting a letter to something else. …

Member Avatar
Member Avatar
+0 forum 4

so I've been trying to write this program that takes the data from a file and outputs the year the rainfall how much it is below/above the average, the average raifall and the std deviation and for some reason I get three C4552 warnings:'>': operator has no effect on three for loops. Help is highly appreciated :( #include<iostream> #include<fstream> #include<iomanip> #include<string> #include<cstring> #include<cstdlib> using namespace std; void readFile(int month[],int year[],double rain[],const int size); double averageRainfall(double rain[],const int size); double belowRainfall(double size,double rain[],double Below[]); double standardDeviation(double Below[],double size); string monthName(int month[], const int size,string monthN[]); int main() { const int size=12; …

Member Avatar
Member Avatar
+0 forum 3

Hi, I need to make "Keygen" that gen text not randomly with two text boxes, i need to use it for "username and "password" gen that i puted to gen. Please help with the code :)

Member Avatar
Member Avatar
+0 forum 10

The End.