coursework

Committer:
riyood
Date:
Sun Nov 27 17:57:06 2016 +0000
Revision:
0:b7287557047e
function;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
riyood 0:b7287557047e 1 #include "signal.h"
riyood 0:b7287557047e 2 #include "stdio.h" // for sprintf()
riyood 0:b7287557047e 3
riyood 0:b7287557047e 4 const char* Signal::c_str (char* str) {
riyood 0:b7287557047e 5 switch(type){
riyood 0:b7287557047e 6 case CONSTANT: sprintf(str, "constant %f", amplitude); break;
riyood 0:b7287557047e 7 case SINE: sprintf(str, "sin %f %f", amplitude, frequency); break;
riyood 0:b7287557047e 8 case SQUARE: sprintf(str, "square %f %f", amplitude, frequency); break;
riyood 0:b7287557047e 9 default: sprintf(str, "none"); break;
riyood 0:b7287557047e 10 }
riyood 0:b7287557047e 11 return str;
riyood 0:b7287557047e 12 }
riyood 0:b7287557047e 13