Exercise

Started by
10 comments, last by sevak 20 years, 8 months ago
I have to complete this exercise in the book im reading but for some reason the code I use doesn''t work. Exercise:A serial transmission line can transmit 960 characters a second. Write a program that will caculate how long it will take to send a file, given the file''s size. Try it on a 400MB(419,430,400 byte) file. Use appropriate units. (A 400MB file takes days) Here is my code #include <iostream> #include <stdlib.h> int main() { double bytes = 0; double hours = 0; cout << "Enter number of Bytes: "; cin >> bytes; hours = bytes/57600; cout << "It will take about " << hours << " hours" <<endl; system("PAUSE"); return 0; }

www.computertutorials.org
computertutorials.org-all your computer needs...
Advertisement
std::cout
std::cin
hours = bytes/3456000;
why 3456000

www.computertutorials.org
computertutorials.org-all your computer needs...
Or place "using namespace std;" somewhere in your source (after the "#include"s)
I don't have a signature
That''s the number of bytes it can transmit per hour (960 * 3600). 57600 is the number of bytes per minute.
o ya your right I forgot about that. O and Brian whats numspace got to do with this?

www.computertutorials.org
computertutorials.org-all your computer needs...
Because you don''t have std:: before cout and cin.


There''s no town drunk here, we all take turns.
Velocity Gaming Force
Right, you either have to say where the cout and cin methods are coming from explicitely (std::cout, std::cin) or you have to tell the compiler that you''re using the std namespace:

using namespace std;
So are you going to put down "Beer Hunter" as your partner when you turn the homework in?
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis

This topic is closed to new replies.

Advertisement