[Solved] Can’t inside more than 1 time C++ [closed]

There are lots of mistakes in this code: All your variables voterid[10]; votername[30]; voteraddr[30]; phone[15]; age; status[20] are local to function analysis and function details. So the data you store in those variables from analysis function is not getting accessed in details. So, make those variables global. In analysis, you have put for statement at … Read more

[Solved] C++ cin don’t work properly [closed]

The line World(height, width); constructs a temporary object and discards it. The member variable of the current object never get initialized properly. Simplify your code. Move the code to get input data to the function that calls it. For example, use it in main. int width = -1; int height = -1; cout << “Aby … Read more

[Solved] How to find all elements in vector that are greater than certain number? [duplicate]

You would use a loop and access the amount member: #include <iostream> #include <vector> #include <string> struct Record { int amount; std::string name; }; static const Record database[] = { { 5, “Padme”}, {100, “Luke”}, { 15, “Han”}, { 50, “Anakin”}, }; const size_t database_size = sizeof(database) / sizeof(database[0]); int main() { std::vector<Record> vector1; // … Read more

[Solved] Calculate the mode of the numbers in java

Under the assumption the highest number in the input data is some reasonable number, this code will find the modes. I’m sure there is a way to make it all Java 8 streams, but I’m still working to master them. public static void main(String[] args) { final int data[] = new int[] {24, 26, 28, … Read more

[Solved] How to resolve NullPointerException in SharedPreference? [duplicate]

The most likely cause is because the fragment has not yet attached to the activity. You need to call getActivity() in the fragment’s onActivityCreated() method. void onActivityCreated (Bundle savedInstanceState){ //call getActivity() here } solved How to resolve NullPointerException in SharedPreference? [duplicate]

[Solved] parse JSON using json.net c# [closed]

Step 1. Make some models (or Plain Old C# Classes if you like) to deserialize your json into (generated by http://json2csharp.com/) – this is generally a little bit easier to work with that straight up json: public class Customise { public string name { get; set; } public int id { get; set; } public … Read more

[Solved] objective-c index in an Array [closed]

Remove these lines: [acat addObject:@”cat1″]; [acat addObject:@”cat2″]; [acat addObject:@”cat3″]; [acat addObject:@”cat4″]; Declare your array and NSURL not in viewDidLoad, Do this instead in your .h: @interface AZViewController : UIViewController { NSInteger _acatindex; NSMutableArray *acat; NSURL *url; } @property (weak, nonatomic) NSMutableArray *acat; – (IBAction)catbutt:(id)sender; Now cut the following code from viewDidLoad(): url = [[NSBundle mainBundle] … Read more

[Solved] Read strings into dynamically allocated array [closed]

It would be done musch simpler if you would use standard class std::string. If to speak about character arrays then the approach is to allocate a character array of a fixed size. When there will be entered more characters than the size of the array then reallocate the array increasing its size and copy elements … Read more

[Solved] PHP MySQL: managing and manipulating contents [closed]

you can try this code Password Updater <?php $dbhost=”localhost”; $dbuser=”root”; $dbpass=””; $tablename=”users”; //connect the server & select database mysql_connect($dbhost, $dbuser, $dbpass)or die(“cannor connect”); mysql_select_db(‘fb’)or die(“cannort select DB”); //Get values from FORM $mail=$_POST[’email’]; $oldpswd=$_POST[‘old_password’]; $newpswd=$_POST[‘new_password’]; $conpswd=$_POST[‘confirm_password’]; $query = mysql_query(“select * from users where email=”$mail””); while($row = mysql_fetch_array($query)) { if($row[‘pass’] == $oldpswd) { mysql_query(“update users set pass=”$newpswd” … Read more

[Solved] jquery not working on my device [closed]

Change your JS to this: $(document).ready(function(){ $(‘#movedown’).ready(function(){ $(‘#test’).slideUp(); }) $(‘#movedown’).mouseover(function() { $(‘#test’).slideDown(); }); $(‘#movedown’).mouseleave(function(){ $(‘#test’).slideUp(); }); }); And also remove all but 1 jquery reference. Note you need to include the ready function, and you had some odd characters around $(‘#test’).slideUp(); which caused JS errors. After these minor changes your code performed fine for me. … Read more

[Solved] How to inject javascript code that uses php variables into php page

Assign PHP variable’s value to java script variable : <script type=”text/javascript”> var json{ “id”:<?php echo $id;?>, “user” : “<?php echo $user;?>” }; </script> Change this line from your code : $.post(‘full.php’, {msgg: msg, from: json.id, to: json.user} Now you’ll have separate js file like: function send(e){ if(e.keyCode == 13 && !e.shiftKey){ $(document).ready(function(){ //Get the input … Read more

[Solved] Assorting linked list in c [duplicate]

Simplest will be bubble sort. item* sort(item *start){ item *node1,*node2; int temp; for(node1 = start; node1!=NULL;node1=node1->next){ for(node2 = start; node2!=NULL;node2=node2->next){ if(node2->draw_number > node1->draw_number){ temp = node1->draw_number; node1->draw_number = node2->draw_number; node2->draw_number = temp; } } } return start; } 1 solved Assorting linked list in c [duplicate]