home Sandy, UT
Wednesday, 2017.11.22
04:02 MDT [GMT-7]
Brionews - Company Logo Condition: Clear
Temperature: 4.1°C (39.4°F)
Barometer: 1030 mb and rising
IT
MIX
News
Low Cost Affordable C C++ PHP mySQL Perl Programs Development
Assignment for Discrete Math class, short for Discrete Structures.
This one uhm I don't remember exactly for what was written.
It was something about combinations or permutations, like: if we have 3 different signals, and every transmission is 1 µs long, how many messages may transmitted in x µs?
Very simple, all was needed was to apply:
long double lRes = pow(-1,sec)/3 + pow(2,sec)*2/3;
Here also file name was just a mere "hw5"
Download the executable: signals-combinations.exe
November 23, 2004

Combinations in a Set

/**
  *  @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");
}

2004.11.23

Vincenzo Maggio