[Solved] Preprocessor examples in C language

[ad_1] The biggest example would be #include<stdio.h> But there are a fair amount. You can also define macros: #define MAX(X,Y) (((X) > (Y)) ? (X) : (Y)) And use header guards #ifndef A_H #define A_H // code #endif There are proprietary extensions that compilers define to let you give processing directives: #ifdef WIN32 // WIN32 … Read more

[Solved] employee’s job to calculate salary using java

[ad_1] Try if (kindOfEmployee == 2) { System.out.println(“Overtime Rate:”); overtimeRate = input.nextInt(); System.out.println(“Overtime Hours:”); overtimeHours = input.nextInt(); overtimePay = overtimeRate*overtimeHours; } 0 [ad_2] solved employee’s job to calculate salary using java

[Solved] How to create a flag with getopts to run a command

[ad_1] Your script has a number of problems. Here is the minimal list of fixes to get it working: While is not a bash control statement, it’s while. Case is important. Whitespace is important: if [“$CHECKMOUNT”= “true”] doesn’t work and should cause error messages. You need spaces around the brackets and around the =, like … Read more

[Solved] PHP script to update mySQL database

[ad_1] Your sql is wrong. Apart from the gaping wide open SQL injection attack vulnerability, you’re generating bad sql. e.g. consider submitting “Fred” as the first name: $First_Name2 = “Fred”; $query = “UPDATE people SET Fred = First_name WHERE ….”; now you’re telling the db to update a field name “Fred” to the value in … Read more

[Solved] Cannot implicitly convert type ‘double’ to ‘float’ with Math.Pow()

[ad_1] Your variables are float, but the method Math.Pow returns a double. Hence you need explicit conversion to be performed on the result of the method. presentValue = futureValue / (float)Math.Pow(1 + rate, years); Note: Math.Pow also takes double as parameters, but still it works. That’s because implicit conversion is taking place. Because double can … Read more

[Solved] Removing duplicates from arraylist using set

[ad_1] Find the intersection Find the union Subtract the intersection from the union Code: public static void main(String[] args) { Set<Integer> set1 = new HashSet<Integer>(Arrays.asList(1, 2, 3, 4, 5)); Set<Integer> set2 = new HashSet<Integer>(Arrays.asList(1, 3, 6, 7)); Set<Integer> intersection = new HashSet<Integer>(set1); intersection.retainAll(set2); // set1 is now the union of set1 and set2 set1.addAll(set2); // … Read more

[Solved] Making div responsive with margin 0 auto in it

[ad_1] It depend and what you want but fixed width and high margin isn’t the solution, you need another wrapper on your image for center them, and adjust your CSS: <div id=”responsivearea”> <div class=”img-center”> <img class=”wp-image-2520 alignleft” src=”http://www.inspuratesystems.com/nayajeevan/wp-content/uploads/2014/11/good-employer.png” alt=”good employer” width=”201″ height=”199″ /> <img class=”wp-image-2521 alignleft” src=”http://www.inspuratesystems.com/nayajeevan/wp-content/uploads/2014/11/gift-of-health.png” alt=”gift of health” width=”201″ height=”199″ /> <img class=”wp-image-2522 … Read more

[Solved] Understand a C program

[ad_1] What the code does is fetch one character from the input stream at a time, and then store the character at the ith position in the s array, then it increments i. It tests for two conditions, if i == lim – 1 then the loop ends, and the ‘\0’ is appended at the … Read more

[Solved] how can i work with 16 digit integer type?

[ad_1] The biggest value an int can hold is 2,147,483,647. Change the variables to unsigned long long, which can hold a maximum of over 18,446,744,000,000,000,000. (You’ll need to use %llu to read in/out unsigned long long variables) Also, always validate inputs, this would have hinted at the issue. if(scanf(“%d”, &a) < 1) { //if we … Read more

[Solved] Unable to access variable in other class for text display [Unity]

[ad_1] You are never initializing the bask in GameManager.cs. public class GameManager : MonoBehaviour { Basket bask; public Text text_apple; // Use this for initialization void Start () { bask = GameObject.Find(“BaskNameInHierarchy”).GetComponent<Basket>() text_apple.text = bask.displayApple; //i want to call the method of displayApple to get the string returned. } } You can also make the … Read more

[Solved] How can I place two images within a UINavigationBar? [closed]

[ad_1] One way to do this is to use UINavigationItem.titleView and UINavigationItem.rightBarButtonItem. Like this : viewController.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”yourimage.png”]]; UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@”yourimage2.jpg”]]]; viewController.navigationItem.rightBarButtonItem = item; Here I am using UIImageView as custom view, but it can be UIButton with custom image. Check this: How to add … Read more

[Solved] How to upload image and status to twitter using twitter4j

[ad_1] You need to use ImageUpload class in twitter4j. The below code describes a typical scenario for image upload with text. AccessToken accessToken = twitterSession.getAccessToken(); ConfigurationBuilder conf = new ConfigurationBuilder(); conf.setOAuthConsumerKey(twitter_consumer_key); conf.setOAuthConsumerSecret(twitter_secret_key); conf.setUseSSL(true); conf.setHttpReadTimeout(2400000); conf.setHttpStreamingReadTimeout(2400000); conf.setOAuthAccessToken(accessToken.getToken()); conf.setOAuthAccessTokenSecret(accessToken.getTokenSecret()); conf.setMediaProviderAPIKey(twitpic_api_key); Configuration configuration = conf.build(); OAuthAuthorization auth = new OAuthAuthorization(configuration); ImageUpload uploader = new ImageUploadFactory(configuration) .getInstance(auth); File photo=new … Read more