Hey, there! recently working with my winform project, I came across a problem, I created a Data table programmatically and gave one column of it, the path to an image. I have done it many times, and it worked all the times before, but this time, the image didn't show, instead it said: "string.byte()" or … Continue reading [.NET] DataGridView not showing the image from Data Table
[VB.NET] DataGrid view slow drawing
Today, working on one of my projects, I came across an irritating problem of .net Control (DataGridView). even with 53 records, the control was drawing very slowly that I could see it stuttering, I thought of enabling "Double Buffer" which I usually do for my forms, but unfortunately, Microsoft doesn't give this feature for DataGridView … Continue reading [VB.NET] DataGrid view slow drawing
[CodeChef Problem] Beautiful Arrays Problem Code: ICPC16B
#include<iostream> using namespace std; int main() { int i,t=0; int T,n; cin>>T; string result[T]; do{ int zero=0,one=0,min_one=0,other_num=0; cin>>n; int a[n]; for(i=0;i<n;i++) { cin >> a[i]; if(a[i]==1) one++; else if(a[i]==0) zero++; else if(a[i]==-1) min_one++; else other_num++; } result[t] = ((other_num > 1) || (min_one > 1 && one == 0) || (min_one > 0 && other_num … Continue reading [CodeChef Problem] Beautiful Arrays Problem Code: ICPC16B
[Function] Find if a value is in an array
bool hasValue(int arr[],int value_to_find,int arrlength) { for(int i=0;i<arrlength;i++) { if(arr[i]==value_to_find) return true; else continue; } return false; }
[Function] Get Digit of a number
int getDigits(int x) { int digits=0; while(x!=0) { x=x/10; digits++; } return digits; }
Reverse a Sentence[Recursion]
/* Name: Print A line in reverse with recursion and without array Author: Dinesh Solanki */ #include<iostream> using namespace std; void reverse() { char c; c = getchar(); if (c != EOF) { reverse(); cout << c; } } int main() { reverse(); return 0; }
[CodeChef Problem] Snake Procession
The annual snake festival is upon us, and all the snakes of the kingdom have gathered to participate in the procession. Chef has been tasked with reporting on the procession, and for this he decides to first keep track of all the snakes. When he sees a snake first, it'll be its Head, and hence he will mark a 'H'. The snakes are long, and when he sees the snake finally slither away, he'll mark a 'T' to denote its tail. In the time in between, when the snake is moving past him, or the time between one snake and the next snake, he marks with '.' s.
Print text/string in Blocks [Program]
Hello again, so i was wandering through my old folders and found a program that i created back then for Arduino, which could print a string in BLOCKS to serial monitor, so as currently i had no arduino with me so i tested it in c++, it works!, i thought i should share it with … Continue reading Print text/string in Blocks [Program]
Regula-Falsi Method C++
#include<iostream> #include<cmath> using namespace std; float f(float x) { return pow(x,3)-2*x-5; } float rFalsi(float a, float b) { return (a*f(b) - b*f(a))/(f(b) - f(a)); } int main() { float a,b,c,e=0,tlr,oldr; int itr=1,dc; cout<<"Enter First value of Interval:"; cin>>a; cout<<"Enter second value of interval:"; cin>>b; cout<<"Please Enter Desired Tolerance(eg. 0.0001):"; cin>>tlr; cout<<"Enter Number of digits for … Continue reading Regula-Falsi Method C++
Newton-Raphson Method C++
#include<iostream> #include<cmath> using namespace std; float f(float x) { return pow(x,3)-2*x-5; } float df(float x) { return 3*pow(x,2)-2; } float newt(float a) { return a-(f(a)/df(a)); } int main() { float a,c,e=0,tlr,oldr; int itr=1,dc; cout<<"Enter First value of Interval:"; cin>>a; cout<<"Please Enter Desired Tolerance(eg. 0.0001):"; cin>>tlr; cout<<"Enter Number of digits for precision:"; cin>>dc; cout<<"\nEntered Interval is: … Continue reading Newton-Raphson Method C++
