[Solved] Is there any code snippet demonstrate the harm of memory leak or fogeting free memory malloced [closed]

[ad_1] Okay I will explain the problem. Computers has limited memory ( modern personal one has about 8 Gigabytes). Operating systems and apps need the memory so their code can be loaded into it and executed by the CPU. Modern systems split the memory into equally sized chunks called pages, the actual page size differs … Read more

[Solved] How to calculate the age of a person? [closed]

[ad_1] may this will help you…. #include<iostream> using namespace std; int main() { system(“TITLE how old are you?”); system(“color f3”); int yearnow,yearthen,monthnow,monththen,age1,age2; cout<<“\t\t\tEnter the current year and month \n\t\t\t(eg. 1997, enter, 7, enter):\n “; cin>>yearnow; cin>>monthnow; cout<<“Enter your birthyear and month: \n”; cin>>yearthen; cin>>monththen; if(monththen >12 || monththen<1) return 1; if(monththen > monthnow){ age1=yearnow-yearthen-1; age2=(12-monththen) … Read more

[Solved] Splitting of words Dynamically in c# [duplicate]

[ad_1] You can go with regex in here like this: Regex rgxData = new Regex(“([0-9 ]+)([a-zA-Z]+)”); Match mData = rgxData.Match(input); string sr = mData.Groups[1].Value.Trim(); string quota = mData.Groups[2].Value.Trim(); This will result in: input = “153 81 2612GEN”; SR: 153 81 2612 Quota: GEN input = “153 81 1 1 1 1 1 1 ABCDE”; SR: … Read more

[Solved] How to get the day number in a month in c# [closed]

[ad_1] public static IEnumerable<int> DaysInMonth(int year, int month, DayOfWeek dow) { DateTime monthStart = new DateTime(year, month, 1); return Enumerable.Range(0, DateTime.DaysInMonth(year, month)) .Select(day => monthStart.AddDays(day)) .Where(date => date.DayOfWeek == dow) .Select(date => date.Day); } Your example: var wednesdaysInSeptember2015 = DaysInMonth(2015, 9, DayOfWeek.Wednesday); Console.Write(String.Join(“,”, wednesdaysInSeptember2015)); // 2,9,16,23,30 For what it’s worth, here is a performance optimized … Read more

[Solved] Change Tracking Entity framework

[ad_1] You can track the operation, the changed columns and the new values by using Change Tracking. However getting the old Value out of Change Tracking is not possible. SQL Server 2016 offers the new feature “Change data capture”, which gives you the needed Information about the old value before the update/delete happened ( see … Read more

[Solved] Regular Expression for numbers?

[ad_1] The regular expression that will match one or more numerals in succession is: \d+ You could apply it this way: Regex.Matches(myString, @”\d+”) Which will return a collection of MatchCollection object. This will contain the matched values. You could use it like so: var matches = Regex.Matches(myString, @”\d+”); if (matches.Count == 0) return null; var … Read more

[Solved] Parse string and swap substrings [closed]

[ad_1] The simplest solution is to use google (First link) here. Also be aware that in C++ we prefer std::string over const char *. Do not write your own std::string, use the built-in one. Your code seems to be more C than C++! [ad_2] solved Parse string and swap substrings [closed]

[Solved] ELSE IF + do nothing c# [closed]

[ad_1] Since you used pseudo code, I’m going to guess at variable names: if(yCoord <= 300 && yCoord >= -130) { vGauge.YCoord = yCoord; } only set your variable if the yCoord falls within a valid range. [ad_2] solved ELSE IF + do nothing c# [closed]

[Solved] Problems with char * and delete [duplicate]

[ad_1] You can delete only what was allocated using the corresponding operator new. String literals have static storage duration. They are not dynamically allocated. According to the C++ Standard 8 Ordinary string literals and UTF-8 string literals are also referred to as narrow string literals. A narrow string literal has type “array of n const … Read more

[Solved] Do and While Loop

[ad_1] You can use the while loop as follows: int i=1; while(i<=7) { sal = load(); rate = calcRate(sal); calcRaise(sal, rate, &raise, &totraise); calcNewSal(sal, raise, &newsal, &totnewsal); calcTotSal(&sal, &totsal); print(sal, rate, raise, newsal, totsal, totraise, totnewsal); fflush(stdin); i++; } And the do-while as follows: int i=1; do { sal = load(); rate = calcRate(sal); calcRaise(sal, … Read more