[Solved] C prog. Pointers and strings [closed]

In your first example, you MUST pass a char pointer for the “%s” modifier so it is actually the way it has to be, you would of course know that if you read the appropriate documentation, like e.g. The C Standard. The second one, is wrong. Because it would invoke undefined behavior. To print the … Read more

[Solved] SQL query for display one field only once which having multiple record

Using CASE Condition and Row_number we can achieve the above Output It’s Purely based on your sample Data DECLARE @Table1 TABLE (projName varchar(1), percentage int) ; INSERT INTO @Table1 (projName, percentage) VALUES (‘A’, 10), (‘A’, 25), (‘B’, 20), (‘B’, 30) ; Select CASE WHEN RN = 1 THEN projName ELSE NULL END projName, percentage from … Read more

[Solved] shell – remove numbers from a string column [closed]

You should have been more clearer when you raise the problem. Do not add test cases later You can try this, I have modified the third field to last but one. But credit to @Kaz ~> more test SER1828-ZXC-A1-10002 SER1878-IOP-B1-98989 SER1930-QWE-A2-10301 SER1930-QWE-A2-10301 SER1930-QWS_GH-A2-10301 SER1930-REM_PH-A2-10301 SER1930-REM-SEW-PH-A2-10301 SER1940-REM-SPD-PL-D3-10301 ~> awk -F- ‘BEGIN { OFS=”-” } { sub(/[0-9]/,””,$(NF-1)); … Read more

[Solved] Subtypes of Arrays

The JLS states that if B is assignable to A, then yes, B[] is assignable to A[]. This opens the door to serious implications though, demonstrated by this code: class A {} class B extends A {} class C extends A {} //… B[] bs = new B[2]; A[] as = bs; as[0] = new … Read more

[Solved] Exit when press 0 in C [duplicate]

Exapmple One of the ways. #include <stdio.h> #include <stdlib.h> void end_proc(void){ printf(“Quitting the program…\n\n”); exit(0); } void input_error_proc(void){ int ch; printf(“ERROR\n”); while((ch = getchar()) != ‘\n’ && ch != EOF);//clear input } int main(void){ int program; while(1){ printf(“\n” “Choose one of the following programs: \n\n” ” (1) Fibonacci Sequence Calculator \n” ” (2) Decimal and … Read more

[Solved] Tell server to not run the code when there is an error

Exception handling is available in PHP since version 5. It allows you to have a more fine-grained control over code when things go wrong ie, when exceptions occur. Put your codes inside try block. if an error occur then the code inside your catch block will run. There is also one more bock. i.e finally … Read more

[Solved] javascript not working (if else ) [closed]

I assume you are trying to do this: function run() { var image = document.getElementById(‘boy’); if (image.src.match(“emoji\walk”)) { image.src = “https://stackoverflow.com/questions/37643551/emoji\run.png”; } else { image.src = “https://stackoverflow.com/questions/37643551/emoji\walk.png”; } } function m() { var image = document.getElementById(‘moon’); if (image.src.match(“emoji\1.png”)) { image.src = “emoji\2.png”; } else if (image.src.match(“emoji\2.png”)) { image.src = “emoji\3.png”; } else if (image.src.match(“emoji\3.png”)) { … Read more

[Solved] I can’t run this code of coverting an array into a list

Your definition for the array is incorrect, it should be: int t[n]; Note that you do not need to declare a local array for your purpose, but you should check for proper conversion by scanf. Note also that insert_end probably does not take a list *** argument. Here is an improved version: void tab2list(int n, … Read more

[Solved] Replace second repeated word in string [closed]

Split the string by space and rename the last word. Then using the StringBuilder concatenate them together back to your original String. String str = “hello I am a example example” String[] parts = str.split(” “); parts[parts.length-1] = “moon”; System.out.println(parts[parts.length-1]); StringBuilder sb = new StringBuilder(); for (int i=0; i<parts.length; i++) { sb.append(parts[i]); sb.append(” “); } … Read more

[Solved] JSON Parse : Uncaught SyntaxError: Unexpected token , JavaScript [closed]

Objects in JSON are represented with {}. Object have key-value pairs. For example: { “foo”: “bar”, “example: “something”, “key”: “value” } Arrays in JSON are represented with []. They are a list of numbers, strings, objects, etc. For instance: [ “foo”, “bar”, “something”, “example” ] You’re problem is that you are using {} for an … Read more

[Solved] Variables from div

Your question lacks a lot of detail. Can there be more than those four names? Can’t you restructure your code to get an easier access to the data? var toParse = document.getElementById(‘names’).innerHTML; var m; var re = /\[(.*)\]/g; while (m = re.exec(toParse)) { console.log(m[1]); } (https://jsfiddle.net/hL4bu5j1/) This code looks for text in [Bracers] and outputs … Read more

[Solved] How to make a responsive picture

In the example you provides, it seems like background image. So you can style it like below background-image: url(“../images/image_name.jpg”); background-size: cover; solved How to make a responsive picture

[Solved] how to convert decimal value into int in c# [closed]

As per your requirement, round decimal up to 2 place using following way : 1) Use Math.Round(). var vatprice= Convert.ToDecimal(Math.Round(dt.Rows[0][5], 2)); 2) second way is var vatprice=Convert.ToDecimal(dt.Rows[0][5].ToString (“#.##”)); solved how to convert decimal value into int in c# [closed]