|
Salt Lake City Wednesday, 2013.06.19 02:52 MDT [GMT-7] |
![]() |
Condition: Mostly Clear Temperature: 26°C/78.6°F Barometer: 1008.5 mb and rising |
| IT | |
|---|---|
| MIX | |
| News |
/**
* @title: hw5.cpp
* @date: 2004.11.23 - 21:44
* @author: vinnie
* @source for hw5.exe
*/
#include <conio.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
void main( )
{
long double lRes;
int iSec;
char strSec[10];
char c;
// code
system("color 1f");
// menu' label
MYMENU: // begin
// reset vars
iSec = 0;
lRes = 0L;
memset( strSec, '\0', 10);
// print intro & menu
system("cls");
printf("\t\t SLCC - CS 2310-01 - Fall '04 - HW5\n");
printf("\n Number of different messages with 3 signals,");
printf("\n transmitted in n microseconds.\n");
printf("\n Please input how many microseconds : ");
gets( strSec);
iSec = atoi( strSec);
//////////////////////////////////////////////////////////////
lRes = pow( -1, iSec) / 3 + pow( 2, iSec) * 2 / 3;
printf("\n In %d microseconds may be transmitted\
\n %Le different messages.\n", iSec, lRes);
//////////////////////////////////////////////////////////////
// ask for an other trip
printf("\n Another one [Y/y/N/n]? ");
while ( !kbhit() );
c = getchar( );
if ( c == 'Y' || c == 'y' ) goto MYMENU;
//////////////////////////////////////////////////////////////
printf("\n Thanks for using HW5\n");
printf(" Vincenzo Maggio Code - released under GPL\n");
system("color 0f");
}
Vincenzo Maggio