[Solved] code will generate compile error [closed]

[ad_1] The problem with this code is that not all paths of the code return a value… i.e. what if age is 0? You can fix this by adding after the last if statement return null this way if none of the conditions are met it will always have a return value. [ad_2] solved code … Read more

[Solved] Annual calender in asp.net page [closed]

[ad_1] If you are using the standard ASP.NET calendar control, then you can style dates by implementing a DayRender(…) event handler. The DayRender event is raised for each day that is created for the Calendar control. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.calendar.dayrender.aspx Here you can check which date you are handling and style it. In your case, this is where … Read more

[Solved] How to write encryption function in C

[ad_1] Since this is probably homework, where the objective is learning rather than producing a correct answer, I’ll offer some guidance. Loop through each character in the string. If the character is a letter, increment the value of the character at that position by one Output the result of this loop. http://www.asciitable.com/ 3 [ad_2] solved … Read more

[Solved] Last word is Failing …?

[ad_1] Try this: #include <stdio.h> #include <stdlib.h> #include <string.h> FILE *fr; int main (int argc, const char * argv[]){ char line[1024]; double uppercase = 0, lowercase = 0; int x = 0; fr = fopen (“PercenUpLow.txt”, “rt”); if (fr == NULL) { printf (“Can’t open file”) ; return EXIT_FAILURE ; } while(fgets(line, 1024, fr) != … Read more

[Solved] VB Net Class in C# [closed]

[ad_1] Need to make sure you’ve added the reference, as well as set the types you’re trying to access to public. Once this is done, you should make using references where appropriate, otherwise you’ll need to specify the entire namespace address each time you reference it. See Namespaces in Visual Basic and look over the … Read more

[Solved] Segmentation Fault on return of main function [closed]

[ad_1] Look at your loop here: for(int i=0; i<3*n; i++) { all[j].h = b[i].h; all[j].w = min(b[i].w,b[i].l); all[j].l = max(b[i].w, b[i].l); j++; // increment all[j].h = b[i].l; all[j].w = min(b[i].w,b[i].h); all[j].l = max(b[i].w, b[i].h); j++; // increment again all[j].h = b[i].w; all[j].w = min(b[i].l,b[i].h); all[j].l = max(b[i].l, b[i].h); j++; // increment once again } Look … Read more

[Solved] Efficient checking for NULL pointers in function called millions of times [closed]

[ad_1] GNU C compiler has a __builtin_expect to tell the optimizer the most probable outcome of a value. It is not standard C though. You can #define macros to wrap around it and conditionally switch which definition to use, based on the compiler. Linux kernel uses it this way (include/linux/compiler.h): #define likely(x) __builtin_expect(!!(x), 1) #define … Read more

[Solved] Parsing input data from a text file [closed]

[ad_1] #include <stdio.h> #include <stdlib.h> struct classes { char name[20]; char department[5];//+1 for ‘\0’ int course_number; }; int main(void){ FILE *file; char buffer[50]; struct classes student, students[48]; int i, count=0; file = fopen(“inputfile.txt”, “r”); while (fgets(buffer, sizeof(buffer), file)){ //Format : NAME is enrolled in DEPARTMENT NUMBER. if(3 == sscanf(buffer, “%19s %*s %*s %*s %4s %d”, … Read more

[Solved] Need Help to understand the do while loop in details

[ad_1] You are right, all values of deck are 0 at the beginning and the loop works because the do{}while(condition); is executing at least once before checking condition. The loop is looking here for the first uninitialized card. Duplicate output is just what the loop is currently checking, it finds an initialized card so it … Read more