Login
Search
Welcome to the iTechForums.
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
To register now click here.
Latest Threads
Advertisements
Forum Statistics
Threads:
Posts: 5
Members:
Number of Users Online:
Welcome to our newest member,
Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2008, 08:18 AM
darknorrath darknorrath is offline
Junior Member
 
Join Date: May 2008
Posts: 1
Default

Reading text files and storing contents into a List C++?


Hi i want to read in a text file and store the contents into a list in C++. I am able to read in the file using fstream.

I have declared a list of type string however the contents of the text file has employee ID number which is of type int. Is is appropriate to store the employees into a list of type string?

How could i modify this code so i can store the contents into the "list "of employees?

Thanks.

Here is my attempted code:

#include <iostream>
#include <list>
#include <fstream>
#include <string>

using namespace std;

int main ()
{
int iQuit = 0;

list<string> employees;
cout << "test";
return 0;

string str;
ifstream myFile("Employees.txt");

if(! myFile)
{
cout << "Error opening the file" <<endl;
return -1;
}

while(! myFile.eof())
{
getline(myFile, str);
cout << str << endl;
}
myFile.close();
cin >> iQuit;
return 0;

}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 08-10-2008, 05:36 PM
bsoaieda bsoaieda is offline
Junior Member
 
Join Date: Aug 2008
Posts: 8
Post

hi


just my two centsbump----------------------------------------------------------------our wow power leveling and wow gold site:buy wow power leveling,wow power leveling, cheap wow power leveling,wow power leveling,Cheap WoW Gold
__________________
WoW Power Leveling
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old Today, 04:24 AM
hijk869 hijk869 is offline
Senior Member
 
Join Date: May 2008
Posts: 536
Thumbs down

电源


  把其他形式的能转换成电能的装置叫做电源。发电机能把机械能转换成电能,干电池能把化学能转换成电能。 发电机、干电池等叫做电源。通过变压器和整流器,把交流电变成直流电的装置叫做整流电源。能提供信号的电子 设备叫做信号源。晶体三极管能把前面送来的信号加以放大,又把放大了的信号传送到后面的电路中去。晶体三极 管对后面的电路来说,也可以看做是信号源。整流电源、信号源有时也叫做电源。  电源是向电子设备提供功率 的装置,也称电源供应器,它提供计算机中所有部件所需要的电能。电源功率的大小,电流和电压是否稳定,将直 接影响计算机的工作性能和使用寿命。  计算机电源是一种安装在主机箱内的封闭式独立部件,它的作用是将交 流电通过一个开关电源变压器换为5V,-5V,+12V,-12V,+3.3V等稳定的直流电,以供应主机箱内系统版,软盘,硬盘驱动及各种适配器扩展卡等系统部件使 用通俗来讲就是, 一个电源坏了,另一个备份电源代替其供电。可以通过为节点和磁盘提供电池后援来增强硬件的可用 性。HP 支持的不间断电源 (UPS),如 HP PowerTrust,可提防瞬间掉电。 磁盘与供电电路的连接方式应使镜像副本分别连接到不同的电源上。根磁盘与其相应的节点应由同一电源电路供电 。 特别是,群集锁磁盘(当重组群集时用作仲裁器)应该有冗余电源,或者,它能由群集中节点之外的电源供电。您 的 HP 代表可提供关于群集的电源、磁盘和 LAN 硬件布局方面的详细信息。 目前许多磁盘阵列和其他架装系统含有多个电源输入,它们应部署为设备上的不同电源输入连接到带有两个或三个 电源输入的独立电路设备上,这样,一般情况下,只要出现故障的电路不超过一个,系统就能继续正常运行。因此 ,如果群集中的所有硬件有 2 个或 3 个电源输入,则要求至少有三个独立的电路,以确保群集的电路设计中没有单点故障。 现在专制电源模块模块电源。。。
__________________
网站优化
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
in an website cms is it better to use a text files or a mysql database to... Yuri K MySQL 0 05-10-2008 05:42 AM
When I copy my harddrive contents onto a personal harddrive, are my files JiveMan Security 0 05-06-2008 01:50 PM
how do I copy text from a website whise files are in .php format??????????? R R PHP 0 05-06-2008 01:46 PM
Why do my PHP files appear as text on my apache (win32) server? drake-182 Apache 0 05-06-2008 01:30 PM
reading delphi db files? cool321steve Delphi & Kylix 1 05-06-2008 12:59 PM

Your Ad Here

All times are GMT. The time now is 09:56 AM.