[Solved] How to transform the digits of a number?

Your logic of result*=devided; is wrong. You need to add the digit(multiplied by it’s 10’s place) to the result. Here is the solution to your problem. int function (int *n, int i){ int temp=n[i]; //tepmorary veraible of the passed number int result=0; int mult=1; int devided; while (temp!=0){ devided=temp%10;//get the last number example 123 = … Read more

[Solved] Function receiving different value than passed

At least part of the problem is that you are not understanding how operators work in C++. for(i=1;i<=n,completed==0;i++){ The expression i<=n,completed==0 has the effect of evaluating i <= n, discarding the result, then evaluating completed == 0, and giving the result of that. So the end condition of the loop is essentially completed == 0. … Read more

[Solved] Find index of returned list result C#

As the error states, it cannot convert from ‘System.Collections.Generic.List’ to ‘string’. However I never knew the function SingleOrDefult() existed. All credit to @maccettura even though he didn’t know what I was trying to do! xD Code change below for the answer: List<string> listFrom = new List<string>(); //Contains a list of strings List<string> listTo = new … Read more

[Solved] bits set by lookup table – Recursive macro [duplicate]

The idea is “recursively defining the problem down to 2-bit values”: 00, 01, 10, 11. They’re not recursive macros, but does represent the technique of recursive decomposition of the problem. The arrangement of macros as a cascade attacks the problem of generating the table of 2^8 values by solving the problem for 2-bits (generating 4 … Read more

[Solved] Error calling sequence

Without any knowledge on what xx is, I’d say yes. For more information check the msdn link for the DownloadString function here: http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadstring(v=vs.110).aspx Also: the strings are lowercased before being compared. solved Error calling sequence

[Solved] how can check the username and password in c#? [closed]

Try like this protected void loginButton_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); con.ConnectionString = “Data Source=.\\SQLEXPRESS;Initial Catalog=University;Integrated Security=True;Pooling=False”; Int32 verify; string query1 = “Select count(*) from Login where ID='” + idBox.Text + “‘ and Password='” + passwordBox.Text + “‘ “; SqlCommand cmd1 = new SqlCommand(query1, con); con.Open(); verify = Convert.ToInt32(cmd1.ExecuteScalar()); con.Close(); if … Read more

[Solved] Sharing c# variables between methods? [closed]

There are a couple of options. Since these methods are event handlers and aren’t directly invoked, the best approach here is likely to make the variable class-level members: private string strHeaderFileName; protected void multiFileUpload_FileUploaded(object sender, FileUploadedEventArgs e) { strHeaderFileName = e.File.FileName; // etc. } protected void btnSave_Click(object sender, EventArgs e) { // here you can … Read more

[Solved] Does printf alter variables?

The output will be 1. Your expression ++x will be x = x+1; In both the printf() you get 1 So the value of x is modified with the pre-increment operator here and in printf() in the second line prints the new value of x which is 1 printf() just prints the value of x … Read more

[Solved] C# Regex for Username

Try this code it will help you: (^[A-Z][a-z]{2,}_[A-Z][a-z]{2,}) using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @”(^[A-Z][a-z]{2,}_[A-Z][a-z]{2,})”; string input = @”Firstname_Lastname fi_na Fi_na fi_Na Fir_Name Firs_name firs_Name”; RegexOptions options = RegexOptions.Multiline; foreach (Match m in Regex.Matches(input, pattern, options)) { Console.WriteLine(“‘{0}’ found at index {1}.”, m.Value, m.Index); } … Read more