[Solved] What is this header error caused by? [closed]

I’m going to go out on a limb and guess that your class is defined something like this: class Sales_item { std::string isbn; } Classes and structs have public, private, and protected labels for their member data, and classes have their members labelled as private by default. You should change it to read: class Sales_item … Read more

[Solved] Codechef : Correct approach or not?

My friend your approach is absolutely right , Only check your datatype to print answer . Your answer may come >10000000000 for any test case . check it, Its open forum , So I won’t mention by pointing. 3 solved Codechef : Correct approach or not?

[Solved] i’m unable to understand how this code works [closed]

Perhaps you have problem understanding the backtrack technique. In this case you should read a little about it: http://en.wikipedia.org/wiki/Backtracking However the code works from the char at position 0 up to 2 following chars. It changes the first char with the folowing, and calls itself with the next char as starting point. Finally switch back … Read more

[Solved] making a shell with C

Your third argument (a[2]) has a newline character at the end. ls thus complains that it can’t find a directory named with a single newline character under your home directory. Fix your command parsing to not include the newline. 3 solved making a shell with C

[Solved] What does a[a[]] do in C?

Translate to: for (int i = 0; i< n; i++) { int temp1 = arr[i]; int temp2 = temp1%k; int temp3 = arr[temp2]; arr[temp2] = temp3+k; } Edit: thanks for the correction @R Sahu 1 solved What does a[a[]] do in C?

[Solved] Problems With List [closed]

I’m not exactly sure what you are trying to accomplish…maybe this? StreamReader reader = new StreamReader(“C:/tut.txt”); String data = reader.ReadLine(); List<String> tok = new List<string>(); foreach (char s in data) { Console.WriteLine(s); tok.Add(s.ToString()); } 1 solved Problems With List [closed]

[Solved] Yes/no does not work [closed]

You should empty the stdin buffer before read something else. void emptyBuffer() { char c=”a”; while (c != ‘\n’ && c != EOF) { c = getchar(); } return; } This function empty the stdin buffer. printf(“Enter your name: “); scanf(“%s”, &string); emptyBuffer(); fprintf(fw, “%d\n%s\n”,p, string); printf(“Enter your telephone number: “); scanf(“%d”,&cislo); emptyBuffer(); fprintf(fw, “%d\n”,cislo); … Read more

[Solved] “Little girl and maximum XOR”

If you read about __builtin_clzll in http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Other-Builtins.html — Built-in Function: int __builtin_clzll (unsigned long long x) Returns the number of leading 0-bits in x, starting at the most significant bit position. If x is 0, the result is undefined. From https://cs.stackexchange.com/a/29510, The maximum possible XOR of any two integers from an interval [l, r] can … Read more

[Solved] taking specific time then output result?

C++11 solution #include <iostream> #include <chrono> #include <thread> int main() { using namespace std::literals; std::this_thread::sleep_for(5s); std::cout << “Hello world” << std::endl; } Read more http://en.cppreference.com/w/cpp/thread/sleep_for solved taking specific time then output result?

[Solved] Finding commas inside a char array

clearing the array , which would have some values in it, would solve this, and this is because when you print it, and there are some other values in it, you get them printed too for( int i = 0; i < maxL; ++i ) newdata[i] = (char)0; solve it completely . EDIT: And to … Read more

[Solved] Last digit of 2^n [closed]

If you look at the sequence of powers of two, you will se a pattern: 1 2 4 8 16 32 64 128 256 512 1024 2048 its always 2 -> 4 -> 8 -> 6 You can use this, to calculate the last digit int GetLastDigit(int power) { if (power == 0) return 1; … Read more

[Solved] How to capture windows username of client [duplicate]

I use this on my devops site to get info about client workstation: string a1 = Request.ServerVariables[“REMOTE_ADDR”]; Label1.Text = “Microsoft & Browser Settings: \t” + Request.UserAgent; Label2.Text = “Web Server IP: ” + HttpContext.Current.Request.ServerVariables[“LOCAL_ADDR”]; Label3.Text = “Request Server DNS: ” + Request.ServerVariables[“REMOTE_ADDR”]; Label4.Text = “Request Host Address DNS: ” + Request.UserHostAddress; Label5.Text = “Request Host … Read more