Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int FS; //File_Size
- int TPS = 0; //Total_Packets_Sent
- int NNOPTBT = 1; //Next_Number_Of_Packets_To_Be_Transmitted
- int NOT = 1; //Number_Of_Transmission
- cout << "Enter File Size: ";
- cin >> FS;
- TPS = 1;
- cout<<"\nTransmission # "<< NOT;
- cout<<"\nNext Number Of Packets To Be Transmitted = " << NNOPTBT;
- cout<<"\nTotal Packets Sent = "<< TPS;
- while(1)
- {
- if(TPS >= FS)
- {
- cout<<"\n\nSent Successfully";
- cout<<"\n\nTotal Number of Transmissions : "<< NOT;
- break;
- }
- else
- {
- if(NNOPTBT < 64) NNOPTBT = NNOPTBT * 2;
- else if(NNOPTBT >= 64) NNOPTBT = NNOPTBT + 1;
- else if(NNOPTBT == 128) NNOPTBT = 1;
- cout<<"\n\nNext Number Of Packets To Be Transmitted = " << NNOPTBT;
- NOT++;
- cout<<"\nTransmission #: "<< NOT;
- TPS = TPS + NNOPTBT;
- cout<<"\nTotal Packets Sent = "<< TPS;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement