电影票务计划。 struct,ifstream [英] Movie Ticket Program. struct, ifstream

查看:99
本文介绍了电影票务计划。 struct,ifstream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有任务要做,但我不知道如何启动它。我从一个文本文件中读取(也是首先打印电影),读取每一行并分配给每个字符串,下一行是价格,所以客户应该可以选择一个以上的电影,最后打印添加税价上涨(5%)。有谁可以帮助我吗。很多提前谢谢。


所以这里输出应该像


这是我的movie.txt文件


I have assignment to do, but i dont know how to start it off. I read from a text file( also print movies r playing first) , read each line and assign to each string and next line is the price so and customer should be able to choose a more then one movie, and at the end print the add up the price with tax(5%). can some one help me please. Thankx alot in advance.

so here is the output should be like

This is my movie.txt file


展开 | 选择 | Wrap | 行号

推荐答案


我有作业要做,但我不知道如何开始。我从一个文本文件中读取(也是首先打印电影),读取每一行并分配给每个字符串,下一行是价格,所以客户应该可以选择一个以上的电影,最后打印添加税价上涨(5%)。有谁可以帮助我吗。很多提前谢谢。


所以这里输出应该像


这是我的movie.txt文件


I have assignment to do, but i dont know how to start it off. I read from a text file( also print movies r playing first) , read each line and assign to each string and next line is the price so and customer should be able to choose a more then one movie, and at the end print the add up the price with tax(5%). can some one help me please. Thankx alot in advance.

so here is the output should be like

This is my movie.txt file


展开 | 选择 | Wrap | 行号



您无法弄清楚哪一部分?


Savage


PS:请阅读我们的发布指南
Which part of this you cannot figure out?

Savage

PS:Please read our posting guidelines



如何开始da程序。我可以在put文件中获得struct fuction,我可以到达da point,它将在屏幕上打印整个文件但是我不知道如何获得每一行并将其分配给每个字符串。比如说


Like how to start off da program. i could get struct fuction in put file, i could get to da point where it will print whole file in screen but i dont kno whow to get each line and assingt it to each string. like let say

展开 | 选择 | Wrap | 行号



类似于如何启动da程序。我可以在put文件中获得struct fuction,我可以到达da point,它将在屏幕上打印整个文件但是我不知道如何获得每一行并将其分配给每个字符串。比如说


struct movieNametype

{

char movieName []

双倍价格; < br $>
}


movieItemtype电影[30];

所以说吧

ifstream InFile;

InFile.open(" movies.txt");

所以这里有一个问题如何从movies.txt中读取每一行?文件并像这样分配

movies [0] .movi​​eName =" Rush Hour 3";

movies [0] .price = 8.50;


,这一直重复到最后。
Like how to start off da program. i could get struct fuction in put file, i could get to da point where it will print whole file in screen but i dont kno whow to get each line and assingt it to each string. like let say

struct movieNametype
{
char movieName [ ]
double price;
}

movieItemtype movies[30];
so let say
ifstream InFile;
InFile.open ("movies.txt");
so here is the question how do i get to read each line from "movies.txt" file and assign it like this
movies[0].movieName="Rush Hour 3";
movies[0].price=8.50;

and this repeats until to end of it.



参见这个


Savage

See this

Savage


这篇关于电影票务计划。 struct,ifstream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆