问题描述
您好我需要帮助阅读此 的内容进入一个对象的矢量数组。我的意思是我如何阅读每个单独的字段示例:
(GIFT-01 Fresch Foundation(703)555-0054 Lopez T-Shirts Clothing 25)
进入下面main()中创建的特定向量对象,而不显示逗号。我需要这个,因为我必须为函数排序这些字段。
对于那些可能对项目的整个要求感兴趣的人, 你去
我尝试过:
/ *
Nana Amponsah
2016年11月14日。
编程项目3
UCRFClassMain.cpp - > United Cause Relief Agency类Main / Client Program.cpp(源代码)
此文件包含演示文件I / O
技术所需的源代码以及向量和对象数组
以及通过基于用户输入的六个选项之一对所述向量进行排序
* /
#include UCRF.h
#include< vector>
#include< sstream>
#include< string>
使用 命名空间标准;
int main()
{
char userChoice; // 菜单输入
string strFileName; // 文件名
vector< string> GID; // 持有礼品ID的矢量
vector< string> DNAME; // 持有捐赠者姓名的矢量
vector< string>电话; // 持有电话号码的矢量
vector< string> POC; // 矢量保持联系人
vector< string>项目; // 向量持有项目捐赠
vector< string>类别; // 向量持有捐赠项目的类型
vector< int>量; // 向量持有捐赠物品的数量
ifstream inFile; // 输入文件
ofstream outFile; // Outut文件
}
这 包含所有必要的文件,如类定义,函数原型等。
Hello I am in need of help in reading the contents of this .csv file into a vector array of objects. What i mean is how do I read each individual field example:
(GIFT-01 Fresch Foundation (703) 555-0054 Lopez T-Shirts Clothing 25)
into the specific vector objects created below in the main() without the commas showing up. I need this because I have to sort these fields for a function.
For those who may be interested in the project entire requirements, here you go
What I have tried:
/* Nana Amponsah November 14, 2016. Programming Project 3 UCRFClassMain.cpp -> United Cause Relief Agency Class Main/Client Program.cpp (source code) This file entails the source codes required to demonstrate file I/O techniques with vectors and making arrays of objects As well sort said vectors via one of six options based on user input */ #include "UCRF.h" #include <vector> #include <sstream> #include <string> using namespace std; int main() { char userChoice; // Menu input string strFileName; // File name vector<string> GID; // Vector holding Gift ID vector<string> DName; // Vector holding Donor Name vector<string> Phone; // Vector holding Phone Number vector<string> POC; // Vector holding point of contact vector<string> Item; // Vector holding item donated vector<string> Category; // Vector holding type of item donated vector<int> amount; // Vector holding amount of donated items ifstream inFile; // Input file ofstream outFile; // Outut file }
This folder contains all the necessary files like the class definitions, function prototypes etc.
这篇关于如何将.CSV excel文件的内容读入对象向量中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!