QLCDNumber display double - double

I'm learning visual programing in Qt by trying to create a simple calculator. I'm having trouble with the QLCDNumber because I am not able to display double numbers, it doesn't show the coma nor the decimals.
The code is pretty simple but it should do the job, but how can I show the coma?
Here is the code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
using namespace std;
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
// VARIABLES GLOBALES
double valor1 = 0;
double valor2 = 0;
double suma = 0;
double resta = 0;
double multiplicacion = 0;
double division = 0;
double raiz = 0;
double resultado;
int contador_decimales = 0;
bool suma_presionada = 0;
bool resta_presionada = 0;
bool resultado_inicializado = 0;
// BOTÓN 1
void MainWindow::on_boton1_clicked()
{
if (contador_decimales == 0){
if (suma_presionada == 0 && resta_presionada == 0){
valor1 = valor1 * 10 + 1;
ui -> pantalla -> display(valor1);
}
else {
valor2 = valor2 * 10 + 1;
ui -> pantalla -> display(valor2);
}
} else {
if (suma_presionada == 0 && resta_presionada == 0){
valor1 = valor1 + 1/contador_decimales;
ui -> pantalla -> display(valor1);
contador_decimales = contador_decimales * 10;
}
else {
valor2 = valor2 + 1/contador_decimales;
ui -> pantalla -> display(valor2);
contador_decimales = contador_decimales * 10;
}
}
}
// BOTÓN 2
void MainWindow::on_boton2_clicked()
{
if (suma_presionada == 0 && resta_presionada == 0){
valor1 = valor1 * 10 + 2;
ui -> pantalla -> display(valor1);
}
else {
valor2 = valor2 * 10 + 2;
ui -> pantalla -> display(valor2);
}
}
// BOTÓN 3
void MainWindow::on_boton3_clicked()
{
if (suma_presionada == 0 && resta_presionada == 0){
valor1 = valor1 * 10 + 3;
ui -> pantalla -> display(valor1);
}
else {
valor2 = valor2 * 10 + 3;
ui -> pantalla -> display(valor2);
}
}
// BOTÓN SUMA
void MainWindow::on_boton_suma_clicked()
{
suma_presionada = 1;
resta_presionada = 0;
contador_decimales = 0;
}
// BOTÓN RESTA
void MainWindow::on_boton_resta_clicked()
{
suma_presionada = 0;
resta_presionada = 1;
contador_decimales = 0;
}
// BOTÓN IGUAL
void MainWindow::on_boton_igual_clicked()
{
// SUMA
if (suma_presionada == 1){
if (valor1 != NULL){
suma = valor1 + valor2;
} else {
suma = resultado + valor2;
}
ui -> pantalla -> display(suma);
resultado = ui -> pantalla -> value();
suma_presionada = 0;
contador_decimales = 0;
valor1 = NULL;
valor2 = 0;
}
// RESTA
if (resta_presionada == 1){
if (valor1 != NULL){
suma = valor1 - valor2;
} else {
suma = resultado - valor2;
}
ui -> pantalla -> display(suma);
resultado = ui -> pantalla -> value();
resta_presionada = 0;
valor1 = NULL;
valor2 = 0;
}
}
// BOTÓN DECIMAL
void MainWindow::on_boton_coma_clicked()
{
contador_decimales = 10;
ui -> pantalla -> smallDecimalPoint();
ui -> pantalla -> setSmallDecimalPoint(true);
}

I found the problem. It is not that the LCD doesn't display doubles, it is that I didn't have a double. I declared contador_decimales as an int, so 1/contador_decimales is an int. I tried casting it to double but it doesn't work, but if I declare contador_decimales as a double, it does.
I guess i was pretty sure it was the LDC because of how little information I found.
Sorry for the dumb question, as it turns out.

Related

In Flutter and if the number after decimal point is equal 0 convert the number to int

This is a function if the endValueFixed is equal for example 12.0 I want to print the number without zero so I want it to be 12.
void calculateIncrease() {
setState(() {
primerResult = (startingValue * percentage) / 100;
endValue = startingValue + primerResult;
endValueFixe`enter code here`d = roundDouble(endValue, 2);
});
}
This may be an overkill but it works exactly as you wish:
void main() {
// This is your double value
final end = 98.04;
String intPart = "";
String doublePart = "";
int j = 0;
for (int i = 0; i < end.toString().length; i++) {
if (end.toString()[i] != '.') {
intPart += end.toString()[i];
} else {
j = i + 1;
break;
}
}
for (int l = j; l < end.toString().length; l++) {
doublePart += end.toString()[l];
}
if (doublePart[0] == "0" && doublePart[1] != "0") {
print(end);
} else {
print(end.toString());
}
}
You may use this code as a function and send whatever value to end.
if (endValueFixed==12) {
print('${endValueFixed.toInt()}');
}
conditionally cast it to an int and print it then :)

How to change the audio sample rate in Unity?

The default audio sample rate is 48000. Is it possible to change it to other values like 44100?
I log the value of AudioSettings.outputSampleRate and it shows 48000. But it doesn't seem possible to change that value.
Here is the code to change sample rate of Unity's AudioClip:
Most simple, but very rough
Averaging approach, but channels are get mixed
Averaging approach for each channel (best quality)
public static AudioClip SetSampleRateSimple(AudioClip clip, int frequency)
{
if (clip.frequency == frequency) return clip;
var samples = new float[clip.samples * clip.channels];
clip.GetData(samples, 0);
var samplesLength = (int)(frequency * clip.length) * clip.channels;
var samplesNew = new float[samplesLength];
var clipNew = AudioClip.Create(clip.name + "_" + frequency, samplesLength, clip.channels, frequency, false);
for (var i = 0; i < samplesLength; i++)
{
var index = (int) ((float) i * samples.Length / samplesLength);
samplesNew[i] = samples[index];
}
clipNew.SetData(samplesNew, 0);
return clipNew;
}
public static AudioClip SetSampleRateAverage(AudioClip clip, int frequency)
{
if (clip.frequency == frequency) return clip;
var samples = new float[clip.samples * clip.channels];
clip.GetData(samples, 0);
var samplesNewLength = (int) (frequency * clip.length) * clip.channels;
var samplesNew = new float[samplesNewLength];
var clipNew = AudioClip.Create(clip.name + "_" + frequency, samplesNewLength, clip.channels, frequency, false);
var index = 0;
var sum = 0f;
var count = 0;
for (var i = 0; i < samples.Length; i++)
{
var index_ = (int)((float)i / samples.Length * samplesNewLength);
if (index_ == index)
{
sum += samples[i];
count++;
}
else
{
samplesNew[index] = sum / count;
index = index_;
sum = samples[i];
count = 1;
}
}
clipNew.SetData(samplesNew, 0);
return clipNew;
}
public static AudioClip SetSampleRate(AudioClip clip, int frequency)
{
if (clip.frequency == frequency) return clip;
if (clip.channels != 1 && clip.channels != 2) return clip;
var samples = new float[clip.samples * clip.channels];
clip.GetData(samples, 0);
var samplesNewLength = (int) (frequency * clip.length) * clip.channels;
var clipNew = AudioClip.Create(clip.name + "_" + frequency, samplesNewLength, clip.channels, frequency, false);
var channelsOriginal = new List<float[]>();
var channelsNew = new List<float[]>();
if (clip.channels == 1)
{
channelsOriginal.Add(samples);
channelsNew.Add(new float[(int) (frequency * clip.length)]);
}
else
{
channelsOriginal.Add(new float[clip.samples]);
channelsOriginal.Add(new float[clip.samples]);
channelsNew.Add(new float[(int) (frequency * clip.length)]);
channelsNew.Add(new float[(int) (frequency * clip.length)]);
for (var i = 0; i < samples.Length; i++)
{
channelsOriginal[i % 2][i / 2] = samples[i];
}
}
for (var c = 0; c < clip.channels; c++)
{
var index = 0;
var sum = 0f;
var count = 0;
var channelSamples = channelsOriginal[c];
for (var i = 0; i < channelSamples.Length; i++)
{
var index_ = (int) ((float) i / channelSamples.Length * channelsNew[c].Length);
if (index_ == index)
{
sum += channelSamples[i];
count++;
}
else
{
channelsNew[c][index] = sum / count;
index = index_;
sum = channelSamples[i];
count = 1;
}
}
}
float[] samplesNew;
if (clip.channels == 1)
{
samplesNew = channelsNew[0];
}
else
{
samplesNew = new float[channelsNew[0].Length + channelsNew[1].Length];
for (var i = 0; i < samplesNew.Length; i++)
{
samplesNew[i] = channelsNew[i % 2][i / 2];
}
}
clipNew.SetData(samplesNew, 0);
return clipNew;
}

Binary addition in java

I wrote a program for a binary addition in java. But the result is sometimes not right.
For example if i add 1110+111. The result should be 10101.
But my program throws out 10001.
Maybe one of you find the mistake.
import java.util.Scanner;
public class BinaryAdder {
public static String add(String binary1, String binary2) {
int a = binary1.length()-1;
int b = binary2.length()-1;
int sum = 0;
int carry = 0;
StringBuffer sb = new StringBuffer();
while (a >= 0 || b >= 0) {
int help1 = 0;
int help2 = 0;
if( a >=0){
help1 = binary1.charAt(a) == '0' ? 0 : 1;
a--;
} if( b >=0){
help2 = binary2.charAt(b) == '0' ? 0 : 1;
b--;
}
sum = help1 +help2 +carry;
if(sum >=2){
sb.append("0");
carry = 1;
} else {
sb.append(String.valueOf(sum));
carry = 0;
}
}
if(carry == 1){
sb.append("1");
}
sb.reverse();
String s = sb.toString();
s = s.replaceFirst("^0*", "");
return s;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("First: ");
String input1 = scan.next("(0|1)*");
System.out.print("Second: ");
String input2 = scan.next("(0|1)*");
scan.close();
System.out.println("Result: " + add(input1, input2));
}
}
this function is much simpler :
public static String binaryAdd(String binary1,String binary2){
return Long.toBinaryString(Long.parseLong(binary1,2)+Long.parseLong(binary2,2));
}
you can change Long.parseLong into Integer.parseInt if you don't expect very large numbers, you can also replace parse(Long/Int) with parseUnsigned(Long/Int) since you don't expect your strings to have a minus sign do you ?
You are not considering the case when
help1 + help2 = 3
So your method String add(String binary1, String binary2) should be like this:
public static String add(String binary1, String binary2) {
int a = binary1.length()-1;
int b = binary2.length()-1;
int sum = 0;
int carry = 0;
StringBuffer sb = new StringBuffer();
while (a >= 0 || b >= 0) {
int help1 = 0;
int help2 = 0;
if( a >=0){
help1 = binary1.charAt(a) == '0' ? 0 : 1;
a--;
} if( b >=0){
help2 = binary2.charAt(b) == '0' ? 0 : 1;
b--;
}
sum = help1 +help2 +carry;
if (sum == 3){
sb.append("1");
carry = 1;
}
else if(sum ==2){
sb.append("0");
carry = 1;
} else {
sb.append(String.valueOf(sum));
carry = 0;
}
}
if(carry == 1){
sb.append("1");
}
sb.reverse();
String s = sb.toString();
s = s.replaceFirst("^0*", "");
return s;
}
I hope this could help you!
sum = help1 +help2 +carry;
if(sum >=2){
sb.append("0");
carry = 1;
} else {
sb.append(String.valueOf(sum));
carry = 0;
}
If sum is 2 then append "0" and carry = 1
What about when the sum is 3, append "1" and carry = 1
Will never be 4 or greater
Know I'm a bit late but I've just done a similar task so to anyone in my position, here's how I tackled it...
import java.util.Scanner;
public class Binary_Aids {
public static void main(String args[]) {
System.out.println("Enter the value you want to be converted");
Scanner inp = new Scanner(System.in);
int num = inp.nextInt();
String result = "";
while(num > 0) {
result = result + Math.floorMod(num, 2);
num = Math.round(num/2);
}
String flippedresult = "";
for(int i = 0; i < result.length(); i++) {
flippedresult = result.charAt(i) + flippedresult;
}
System.out.println(flippedresult);
}
}
This took an input and converted to binary. Once here, I used this program to add the numbers then convert back...
import java.util.Scanner;
public class Binary_Aids {
public static void main(String args[]) {
Scanner inp = new Scanner(System.in);
String decimalToBinaryString = new String();
System.out.println("First decimal number to be added");
int num1 = inp.nextInt();
String binary1 = decimalToBinaryString(num1);
System.out.println("Input decimal number 2");
int num2 = inp.nextInt();
String binary2 = decimalToBinaryString(num2);
int patternlength = Math.max[binary1.length[], binary2.length[]];
while(binary1.length() < patternlength) {
binary1 = "0" + binary2;
}
System.out.println(binary1);
System.out.println(binary2);
int carry = 0;
int frequency_of_one;
String result = "";
for(int i = patternlength -i; i >= 0; i--) {
frequency_of_one = carry;
if(binary1.charAt(i) == '1') {
frequency_of_one++;
}
if(binary2.charAt(i) == '1') {
frequency_of_one++;
}
switch(frequency_of_one) {
case 0 ;
carry = 0;
result = "1" + result;
break;
case 1 ;
carry = 0;
result = "1" + result;
break;
case 2;
carry = 1;
result = "0" + result;
breake;
case 3;
carry = 1;
result = "1" + result;
breake;
}
}
if(carry == 1) {
result = "1" + result;
}
System.out.println(result);
}
public static String decimalToBinaryString(int decimal1) {
String result = "";
while(decimal1 > 0) {
result = result + Math.floorMod(decimal1, 2);
decimal = Math.round(decimal1/2);
}
String flipresult = "";
for(int i = 0; i < result.length[]; i++) {
flipresult = result.charAt(i) + flippedresult;
}
return flippedresult;
}
}

coffeescript strange behavior in subtraction

I must be going crazy. Coffeescript is continualy returning '0' for the difference between two non-equal integers.
x = #location[0]
y = #start[0]
console.log "#{x} - #{y} = #{x-y}"
This is outputting:
350 - 322 = 0
250 - 278 = 0
... and so on
I'm completely confused!
Edit: Here's the source in both coffee and the compiled js
class Branch
constructor: (#length, #start, #angle, #generation, #parent) ->
return if #generation >= RECURSION_LIMIT
#angleVariation = pi/3
#ratio = 2/(1+root(5))
#maxChildren = 10
#parent ?= null
#unit = 2
#children = []
#location = #start
#childLocations = [Math.random()*#length*#ratio/2+(#length*#ratio) \
for n in [0...#maxChildren]]
grow: ->
gl.beginPath()
moveTo #location
#location[0] += #unit * cos(#angle)
#location[1] -= #unit * sin(#angle)
lineTo #location
gl.stroke()
console.log #getLength()
if #getLength() >= #childLocations[#children.length]
#birthChild()
getLength: ->
x = #location[1]
y = #start[1]
console.log "#{x} - #{y} = #{x-y}"
return 1 #root( (#location[0]-#start[0])**2 + (#location[1]-#start[1])**2 )
birthChild: ->
angle = #angle + (Math.random()*#angleVariation*2) - #angleVariation
child = new Branch #length * #ratio, #location, angle, #generation+1, this
And in js:
Branch = (function() {
function Branch(length, start, angle, generation, parent) {
var n, _ref;
this.length = length;
this.start = start;
this.angle = angle;
this.generation = generation;
this.parent = parent;
if (this.generation >= RECURSION_LIMIT) {
return;
}
this.angleVariation = pi / 3;
this.ratio = 2 / (1 + root(5));
this.maxChildren = 10;
if ((_ref = this.parent) == null) {
this.parent = null;
}
this.unit = 2;
this.children = [];
this.location = this.start;
this.childLocations = [
(function() {
var _i, _ref1, _results;
_results = [];
for (n = _i = 0, _ref1 = this.maxChildren; 0 <= _ref1 ? _i < _ref1 : _i > _ref1; n = 0 <= _ref1 ? ++_i : --_i) {
_results.push(Math.random() * this.length * this.ratio / 2 + (this.length * this.ratio));
}
return _results;
}).call(this)
];
}
Branch.prototype.grow = function() {
gl.beginPath();
moveTo(this.location);
this.location[0] += this.unit * cos(this.angle);
this.location[1] -= this.unit * sin(this.angle);
lineTo(this.location);
gl.stroke();
console.log(this.getLength());
if (this.getLength() >= this.childLocations[this.children.length]) {
return this.birthChild();
}
};
Branch.prototype.getLength = function() {
var x, y;
x = this.location[1];
y = this.start[1];
console.log("" + x + " - " + y + " = " + (x - y));
return 1;
};
Branch.prototype.birthChild = function() {
var angle, child;
angle = this.angle + (Math.random() * this.angleVariation * 2) - this.angleVariation;
return child = new Branch(this.length * this.ratio, this.location, angle, this.generation + 1, this);
};
return Branch;
})();

can't access static method of a simple cs file in xaml.cs file

I'm creating an app for my semester project. In this project I have a simple class file and a few xaml pages. In one xaml page the code checks the value of a string and depending on that value runs a countdown timer. If the value of string is equal to a certain string then it should call a method from simple class where the value of string is changed and then it should navigate to the next xaml page.
When I call the function the application breaks. No error or anything, it just breaks. I don't know why. I have called other functions of same class file in other xaml files and they work perfect but here I'm having trouble. I guess it has something to do with timer.
xaml.cs:
namespace TrafficGuru
{
public partial class Page2 : PhoneApplicationPage
{
DispatcherTimer countDownTimer;
int check;
public Page2()
{
InitializeComponent();
tbl.Text = global.str;
if (global.str == "YOUR LIGHT IS ON FOR : ")
{
check = 0;
}
if (global.str == "YOUR LIGHT WILL BE ON IN:")
{
check = 1;
}
if (global.str == "YOUR LIGHT WILL NOT BE ON FOR UNTIL ATLEAST " + global.x * 15 + " MORE SECS.YOU WILL GET AN UPDATE IN:")
{
check = 2;
}
countDownTimer = new DispatcherTimer();
countDownTimer.Interval = new TimeSpan(0, 0, 0, 1);
countDownTimer.Tick += new EventHandler(countDownTimerEvent);
countDownTimer.Start();
test.Content = "" + "seconds remaining";
}
int count = global.cdt;
void test_Click(object sender, EventArgs e) { }
void countDownTimerEvent(object sender, EventArgs e)
{
test.Content = count + " Seconds";
if (count > 0)
{
count--;
}
else if (count == 0)
{
if (check == 0)
{
test.Content = "STOP!!";
}
else if (check == 1)
{
test.Content = "GO!!!";
}
if(check==2)
{
string x= global.rego();//the method i m trying to call its public and static
NavigationService.Navigate(new Uri("/Page3.xaml", UriKind.RelativeOrAbsolute));*/
}
}
}
}
}
globalx class code::
if (x == 1)
{
str = "YOUR LIGHT WILL BE ON IN:";
}
cdt = x*15;
l[m].resetcount();
a[m] = 0;
l[m].setlight("RED");
c = 9;
}
if (l[0].getcount() == 0 || s > 0)
{
l[0].Createcar();
}
a[0] += l[0].getcount();
t[0] = l[0].gettime();
if (l[1].getcount() == 0 || s > 0)
{
l[1].Createcar();
}
a[1] += l[1].getcount();
t[1] = l[1].gettime();
if (l[2].getcount() == 0 || s > 0)
{
l[2].Createcar();
}
a[2] = l[2].getcount();
t[2] = l[2].gettime();
if (l[3].getcount() == 0 || s > 0)
{
l[3].Createcar();
}
a[3] += l[3].getcount();
t[3] = l[3].gettime();
s++;
if (s % 2 != 0)
{
var now1 = DateTime.Now;
tv = (now1 - begin).TotalMilliseconds;
tym = Convert.ToInt32(tv);
int[] pkl = { 0, 0 };
maxi(a, t, s, tym, ref pkl);
m = pkl[0];
}
else
{
var now1 = DateTime.Now;
tv = (now1 - begin).TotalMilliseconds;
tym = Convert.ToInt32(tv);
int[] pkj = { 0, 0 };
maxi(a, t, s, tym, ref pkj);
q = pkj[0];
}
return str;
}
COMPLETE GLOBAL CLASS WITH GO AND REGO
public static class globalx
{
public static int n;
public static int s;
public static int m;
public static int q;
public static int c;
public static int f;
public static lane[] l = new lane[4];
public static double tv;
public static int tym;
public static int[] a = { 0, 0, 0, 0 };
public static int[] t = new int[4];
public static string str="asdf";
public static int cdt; //countdowntime
public static int x;
public static DateTime begin;
public static void start()
{
begin = DateTime.Now;
for (int i = 0; i < 4; i++)
{ l[i] = new lane(); }
var now = DateTime.Now;
tv = (now - begin).TotalMilliseconds;
tym = Convert.ToInt32(tv);
l[0].Createcar();
a[0] += l[0].getcount();
t[0] = l[0].gettime();
l[1].Createcar();
a[1] += l[1].getcount();
t[1] = l[1].gettime();
l[2].Createcar();
a[2] += l[2].getcount();
t[2] = l[2].gettime();
l[3].Createcar();
a[3] += l[3].getcount();
t[3] = l[3].gettime();
now = DateTime.Now;
tv = (now - begin).TotalMilliseconds;
tym = Convert.ToInt32(tv);
int[] r = { 88, 99 };
maxi(a, t, s, tym, ref r);
m = r[0];
q = r[1];
c = 0;
f = 9;
}
public static string go()
{
l[m].setlight("GREEN");
var now = DateTime.Now;
tv = (now - begin).TotalMilliseconds;
tym = Convert.ToInt32(tv);
l[m].settime(tym);
if (n == m + 1)
{
c = 0;
str = "YOUR LIGHT IS ON FOR : ";
cdt = 15;
l[m].resetcount();
a[m] = 0;
l[m].setlight("RED");
}
if (n == q + 1)
{
c = 9;
str = "YOUR LIGHT WILL BE ON IN:";
cdt = 15;
l[m].resetcount();
a[m] = 0;
l[m].setlight("RED");
}
if (n != m + 1 && n != q + 1)
{
x = m + 1 - n;
if (x < 0)
{
x = 0 - x;
}
str = "YOUR LIGHT WILL NOT BE ON FOR UNTIL ATLEAST " + x * 15 + " MORE SECS.YOU WILL GET AN UPDATE IN:";
if (x == 1)
{
str = "YOUR LIGHT WILL BE ON IN:";
}
cdt = x*15;
a[m] = 0;
l[m].setlight("RED");
c = 9;
}
if (l[0].getcount() == 0 || s > 0)
{
l[0].Createcar();
}
a[0] += l[0].getcount();
t[0] = l[0].gettime();
if (l[1].getcount() == 0 || s > 0)
{
l[1].Createcar();
}
a[1] += l[1].getcount();
t[1] = l[1].gettime();
if (l[2].getcount() == 0 || s > 0)
{
l[2].Createcar();
}
a[2] = l[2].getcount();
t[2] = l[2].gettime();
if (l[3].getcount() == 0 || s > 0)
{
l[3].Createcar();
}
a[3] += l[3].getcount();
t[3] = l[3].gettime();
s++;
if (s % 2 != 0)
{
var now1 = DateTime.Now;
tv = (now1 - begin).TotalMilliseconds;
tym = Convert.ToInt32(tv);
int[] pkl = { 0, 0 };
maxi(a, t, s, tym, ref pkl);
m = pkl[0];
}
else
{
var now1 = DateTime.Now;
tv = (now1 - begin).TotalMilliseconds;
tym = Convert.ToInt32(tv);
int[] pkj = { 0, 0 };
maxi(a, t, s, tym, ref pkj);
q = pkj[0];
}
return str;
}
public static string rego()
{
{
l[q].setlight("GREEN");
var now = DateTime.Now;
tv = (now - begin).TotalMilliseconds;
tym = Convert.ToInt32(tv);
l[q].settime(tym);
if (n == q + 1)
{
f = 0;
str = "YOUR LIGHT IS ON FOR : ";
cdt=15;
}
if (n == m + 1)
{
str = "YOUR LIGHT WILL BE ON IN:";
cdt=15;
l[q].resetcount();
a[q] = 0;
l[q].setlight("RED");
f = 9;
}
if (n != m + 1 && n != q + 1)
{
x = m + 1 - n;
if (x < 0)
{
x = 0 - x;
}
str = "YOUR LIGHT WILL NOT BE ON FOR UNTIL ATLEAST " + x * 15 + " MORE SECS.YOU WILL GET AN UPDATE IN:";
if (x == 1)
{
str = "YOUR LIGHT WILL BE ON IN:";
}
cdt = x * 15;
a[q] = 0;
l[q].setlight("RED");
f = 9;
}
}
if (l[0].getcount() == 0 || s > 0)
{
l[0].Createcar();
}
a[0] += l[0].getcount();
t[0] = l[0].gettime();
if (l[1].getcount() == 0 || s > 0)
{
l[1].Createcar();
}
a[1] += l[1].getcount();
t[1] = l[1].gettime();
if (l[2].getcount() == 0 || s > 0)
{
l[2].Createcar();
}
a[2] = l[2].getcount();
t[2] = l[2].gettime();
if (l[3].getcount() == 0 || s > 0)
{
l[3].Createcar();
}
a[3] += l[3].getcount();
t[3] = l[3].gettime();
s++;
if (s % 2 != 0)
{
var now = DateTime.Now;
tv = (now - begin).TotalMilliseconds;
tym = Convert.ToInt32(tv);
int[] pkl = { 0, 0 };
maxi(a, t, s, tym, ref pkl);
m = pkl[0];
}
else
{
var now = DateTime.Now;
tv = (now - begin).TotalMilliseconds;
tym = Convert.ToInt32(tv);
int[] pkj = { 0, 0 };
maxi(a, t, s, tym, ref pkj);
q = pkj[0];
}
return str;
}
Sourround your code with try catch and see what's the message.
try
{
// Your Code
}
catch (Exception ex)
{
Debug.writeline(ex.Message);
}