Advertisement
Karim_Gabr

Untitled

Dec 25th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int FS; //File_Size
  8. int TPS = 0; //Total_Packets_Sent
  9. int NNOPTBT = 1; //Next_Number_Of_Packets_To_Be_Transmitted
  10. int NOT = 1; //Number_Of_Transmission
  11.  
  12. cout << "Enter File Size: ";
  13. cin >> FS;
  14. TPS = 1;
  15. cout<<"\nTransmission # "<< NOT;
  16. cout<<"\nNext Number Of Packets To Be Transmitted = " << NNOPTBT;
  17. cout<<"\nTotal Packets Sent = "<< TPS;
  18.  
  19. while(1)
  20. {
  21. if(TPS >= FS)
  22. {
  23. cout<<"\n\nSent Successfully";
  24. cout<<"\n\nTotal Number of Transmissions : "<< NOT;
  25. break;
  26. }
  27. else
  28. {
  29. if(NNOPTBT < 64) NNOPTBT = NNOPTBT * 2;
  30. else if(NNOPTBT >= 64) NNOPTBT = NNOPTBT + 1;
  31. else if(NNOPTBT == 128) NNOPTBT = 1;
  32. cout<<"\n\nNext Number Of Packets To Be Transmitted = " << NNOPTBT;
  33. NOT++;
  34. cout<<"\nTransmission #: "<< NOT;
  35. TPS = TPS + NNOPTBT;
  36. cout<<"\nTotal Packets Sent = "<< TPS;
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement