[Solved] compare first word of a string array with a string in c

strtok is ok for this and you should do something like: #include <string.h> int i = 0; char *token; int different; while(i < size){ token = strtok(array[i], ” “); different = strcmp(word, token); if(different){ //do something } i++; } 3 solved compare first word of a string array with a string in c

[Solved] I have been stuck on this homework: [closed]

Here’s one way to do it – using nested functions: (function(){ (function(){ return arguments[1]<11?arguments.callee( arguments[0],arguments[1]+1,arguments[2]+’ ‘+ (arguments[1]+arguments[0]*10)):console.log(arguments[2]); }(arguments[0],1,”)); return arguments[0]<9?arguments.callee(arguments[0]+1):0; }(0)); See demo on jsbin. It will give you extra points for using closures, recursion, immediately invoked function expressions, and not using global variables – thus not polluting the namespace. If you carefully follow the … Read more

[Solved] Data Structure for keeping time and day of the week PHP

Untested and probably not the best way class TimeWeekday { private $hour; private $minute; private $day; private $days = array(‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’, ‘Saturday’, ‘Sunday’); public function __construct($hour, $minute, $day) { $this->hour = $hour; $this->minute = $minute; $this->day = $day; } public function add($hours, $minutes, $days = 0) { $newMinutes = $this->minute + $minutes; … Read more

[Solved] How to print number and “*” combination in java

this code will work try this………….:) public class simple { public static void main(String[] args) { // TODO Auto-generated method stub int n; n=3; for(int i=1;i<2*n;i++){ if(i<=n){ for(int j=1;j<i;j++){ System.out.print(i+”*”); } System.out.println(i); } else{ for(int j=i+1;j<2*n;j++){ System.out.print(2*n-i+”*”); } System.out.println(2*n-i); } } } } solved How to print number and “*” combination in java

[Solved] How to retrieve data from a website into an iphone app

If your problem is getting data from website to iphone then you can just use JSON Parsing to get data. Just you have to pass all the data as JSON string in iPhone from your website. And then parse the data once received into your iPhone. Here you can refer to this link http://www.raywenderlich.com/5492/working-with-json-in-ios-5 Hope … Read more

[Solved] How to animate scroll down and up the webpage using jquery [duplicate]

If I understand correctly, this is what you’re looking for: $(document).ready(function() { $(‘ul.navigation’).on(‘click’, ‘a’, function(e) { e.preventDefault(); $(‘html, body’).animate({ scrollTop: $( $.attr(this, ‘href’) ).offset().top }, 500); }); }); 7 solved How to animate scroll down and up the webpage using jquery [duplicate]

[Solved] Find word in random string

try boolean containsWord(String s, String w) { List<Character> list = new LinkedList<Character>(); for (char c : s.toCharArray()) { list.add(c); } for (Character c : w.toCharArray()) { if (!list.remove(c)) { return false; } } return true; } 0 solved Find word in random string

[Solved] Javascript : Sum into array

Here is an object version. This is not really what you’re after, but along the same lines and honestly, a bit neater as it’s a data structure. var myArray = [ “Apple: 10”, “Apple: 3”, “Banana: 3”, “Pear: 7”, “Pineapple: 7” ]; var newArray = {}; myArray.forEach(function(val) { var item = val.split(“:”); var key = … Read more

[Solved] Update concatenated String when other Strings are updated [closed]

Revised Because strings are immutable their references aren’t copied. To get around this you can use a StringBuffer, but because you want to update a string and have it reflect on another string, your going to need to do some encapsulation of the StringBuffer’s to accomplish it. class StringChain { private StringBuffer[] buffers; public StringChain(StringBuffer[] … Read more

[Solved] Use awk to find letters and print results [closed]

I think you are looking for this: awk ‘/^[JM]/{print $1,$2}’ i_ve_got_an_vi_edirtor_with_some_collums.file update Now i need the same but only for students that the surname starts from [A-D] awk ‘$2~/^[A-D]/{print $1,$2}’ i_ve_got_an_vi_edirtor_with_some_collums.file 16 solved Use awk to find letters and print results [closed]

[Solved] if display is block change it to none with javascript

try this, document.querySelector(“button”).addEventListener(“click”, changeDiv); function changeDiv(){ var element = document.getElementById(“element1″); element.style.display = (element.style.display == ‘none’) ? ‘block’ : ‘none’; } #element1{display:block} <div id=”element1”>Sample</div> <button>Click here</button> 2 solved if display is block change it to none with javascript