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;
}
That''s the number of bytes it can transmit per hour (960 * 3600). 57600 is the number of bytes per minute.
Because you don''t have std:: before cout and cin.
There''s no town drunk here, we all take turns.
Velocity Gaming Force
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;
using namespace std;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement