473,836 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

urgently required source code:::Arrays and pointers to acess strings from a file

1 New Member
AOA:
Is there any one to help me.i am in great trouble.i want to
read a file in c++ program that is consisting of data in 2cols and 70 rows.
Tokens freq
abcd 50
dssd 87
. .
. .
. .
. .
i have to store Token(1st col) in one Array1[] and 2nd cols (Freq) in Array2[]
finding the maximun value in array2[].
kindly send me the exact code i want the code urgently.thanxs in advance.
Allah Hafiz.......... .....
Sep 25 '06 #1
1 1792
gasfusion
59 New Member
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6.         int SIZE = 34; // array size;
  7.         int i = 0;
  8.         string myArray[34];
  9.     ifstream fin("mytext.txt");
  10.         /* Extract all records */
  11.         while (i<SIZE && fin >> myArray[i])
  12.             i++;
  13. return 0;
  14. }
  15.  
I haven't checked the code, but it should work.

I think you can figure out the rest of the problem by yourself.
Sep 25 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1528
by: fake | last post by:
Leaked Windows 2000 Source Code File Download instructions for this file are available at: http://sazerjr.tripod.com windows_2000_source_code.zip (203.85MB)
1
5791
by: Marek Prerovsky | last post by:
Hello, I implemented some Python functions in my C/C++ code. I need to know the Python source file name and line number of just executed Python command which calls my function. How can I get this information inside my C/C++ function? Thanks for any help. Marek
4
3021
by: jack | last post by:
Hi there, I have a short question about template function definition. 1) The following files will not compile in M$ VC++ but will have no problem with g++. 2) However, if I uncomment all comments in all three files, then it is ok in both compilers.
3
15744
by: ^_^ | last post by:
How to convert HEX <-> DEC constant value in C source file, and write out the result c files? a=4; b=6; from or to a=0x4;
1
1457
by: BigAbility | last post by:
i'm learning about some controls of Vs.net 2005 . but finding some source code of 2005 is very difficult.. Where can i find Vs.net 2005 Source file or example ...?? i think upgrading vs.net 2003 project is different from 2005 project coding style such as 2003 project don't use program.cs file that's why i want to see some
8
2595
by: Bob | last post by:
I need to create a Regex to extract all strings (including quotations) from a C# or C++ source file. After being unsuccessful myself, I found this sample on the internet: @"@?""""|@?"".*?(?!\\).""|''|'.*?(?!\\).'" I am inputting the entire source file string and using it with RegexOptions.Singleline. This works OK with, unless the string ends with a back-slash. For example: "This is a test\\". Can anybody see how to fix this...
4
1600
by: amit | last post by:
Hi guys!I am trying to write a program which will segregate some selected keywords from a given file.The source code is given alongwith #include<stdio.h> #include<string.h> char key_set={"ami\0","inc\0","lud\0"}; #define MAX_KW_SIZE 10 #define MAX_OCUR 100
9
2244
by: phenrol | last post by:
I am trying to access a pointer to a class that I defined in a separate source file from another one. Here is an example of what I have: //myclass.h file class testclass { public: testclass::testclass(void); int setintfunction(int testinteger); int getintfunction(void); testclass::~testclass(voide);
5
3350
by: ganesh.kundapur | last post by:
Hi, I want to know how to compile the C source file without using the compiler directly. I mean to say by using compiler componets such as ( cpp, cc, as, ld ). I tried to compile the fallowing code as fallows file name: hello.c # include <stdio.h> int main ( void )
13
2259
by: sachin | last post by:
Hi, Is it possible to do something like this: unsigned char arr = { #include "cFile.c" } I need that C source file cFile.c to compile and its binary output to include in array.
0
9810
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10818
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10526
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10565
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6972
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5641
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.