[Solved] GCC compiler cannot find stdio.h

[ad_1] I solved it. My problem was that I had two C compilers installed at the same time, the other one came along with Free Pascal. Found it out through checking every folder in my Path environment variable. Thanks for the replies. [ad_2] solved GCC compiler cannot find stdio.h

[Solved] The variable has not been assigned [duplicate]

[ad_1] The problem is that you don’t initialize the property private Material material; When you create object like that you create a reference that points to null. In your code you are trying to modify this object but since it’s not initialized it’s null. The solution is to initialize it in the constructor like so: … Read more

[Solved] Why doesnt vector support size as member variable like length variable in a Java class, instead a function size()? [closed]

[ad_1] Why doesn’t std::vector or other containers have length as a member variable, instead of a function? Because it would be writable if it was a public member variable. Since it makes no sense to write to the size member of a vector, the designers made the size member private and provided a size() method … Read more

[Solved] C++ : using prime number and not a prime number

[ad_1] Just define a Boolean variable and set its value to ‘true’. You only need to run a loop “n/2 times” as the maximum divisor is half of the actual number. So, if the input number is divisible by any value between ‘2-n/2’, set the value of Boolean variable false. In the end, print the … Read more

[Solved] How much RAM would a lookup table for converting positive 32 bit integers to null terminated strings take

[ad_1] Let S(n) be the string for number n. Consider S(429,496,730) through S(4,294,967,295). By partitioning this into subranges S(429,496,730) through S(999,999,999) and S(1,000,000,000) through S(4,294,967,295), we can see they require (999,999,999−429,496,730+1)•10 bytes and (4,294,967,295−1,000,000,000)•11 bytes (10 bytes for nine digits plus a null terminator, and similarly 11 bytes for 10 digits and a terminator.) This … Read more

[Solved] C++ recursive algorithm for permutation [closed]

[ad_1] Your problem seems to be in the “smallString” function. In that function, OutOfRange is used in s[j]. I put print like for(i=0,j=0;j<s.length();i++,j++) { if(i==k){j++;} cout<<“smallString:: s ::”<<s<<‘\t'<<“k::”<<k<<‘\n’; res.push_back(s[j]); //Problem is here… } Now Output print is like smallString:: s ::abc k::0 smallString:: s ::abc k::0 smallString:: s ::bc k::0 smallString:: s ::bc k::1 smallString:: … Read more

[Solved] c++ array of type class [closed]

[ad_1] The first you have correctly identified is caused by access to a private member. The fix? A public member function which returns the menu: string getMenu(); The second is an invalid attempt to treat ‘mimmos’ as an array when infact it is a single instance. Since the comment above it indicates it is an … Read more

[Solved] Read from file C++ (Simple) [duplicate]

[ad_1] You can use this: #include <iostream> #include <fstream> #include <string> using namespace std; void main () { string line; ifstream myfile (“example.txt”); //change this to your file’s name if (myfile.is_open()) { while ( getline (myfile,line) ) { cout << line << ‘\n’; } myfile.close(); } else cout << “Unable to open file”; } [ad_2] … Read more

[Solved] Memory at runtime

[ad_1] I’d suggest counting the number of lines first. int tmp; int linecount = 0; FILE *fp = fopen(“file.txt”,”r”); while ((tmp=fgetc(fp))!=EOF) { if (tmp==’\n’) ++linecount; } rewind(fp); // resets the stream to beginning of file From there, you can malloc the appropriate amount of array pointers (instead of initializing a fixed number). char** lines; lines … Read more

[Solved] C pointer—function relation [duplicate]

[ad_1] The difference is the type of the parameters you call the function with. First case: The type of x is int and the foo function is expecting int *. So you have foo(&x, &y); Second case: The type of p1 is int * and the swap function is also expecting int *. So you … Read more

[Solved] C# Not able to return to my another class file

[ad_1] In your main.cs you need to add one line. [Test] public void Test_MyPage() { LoginPageObject objLogin = new LoginPageObject(); FunctionTest cc = objLogin.FunctionAbcTest(); FunctionTest objAbcTest = new FunctionTest(); objAbcTest.SpeedTest(); } Also change your Xpath to [FindsBy(How = How.XPath, Using = “//div[@id=’cssmenu’]/ul/li[3]/a/span”)] public IWebElement UserForm { get; set;} This will solve your problem. And I … Read more

[Solved] Unable to send E-mail with Attachment

[ad_1] According to http://msdn.microsoft.com/en-us/library/6sdktyws.aspx your Attachment constructor is trying to set the ContentType with the second parameter but you’re passing in a filename, are you sure that is correct? You should probably change that part to something like: ContentType contentType = // create suitable type here based on your file format Attachment attachment = new … Read more

[Solved] Searching for the newest update in a directory c#

[ad_1] You can use LINQ: int updateInt = 0; var mostRecendUpdate = Directory.EnumerateDirectories(updateDir) .Select(path => new { fullPath = path, directoryName = System.IO.Path.GetFileName(path) // returns f.e. Update15 }) .Where(x => x.directoryName.StartsWith(“Update”)) // precheck .Select(x => new { x.fullPath, x.directoryName, updStr = x.directoryName.Substring(“Update”.Length) // returns f.e. “15” }) .Where(x => int.TryParse(x.updStr, out updateInt)) // int-check and … Read more