So i want to hodl my mouse and by moving the mouse i want my vector to rotate around, which of the built in events should i use? i tryed mousedown event but that s not what i m looking for obviously.Maybe i should combine two mouse events instead?
So i want to hodl my mouse and by moving the mouse i want my vector to rotate around, which of the built in events should i use? i tryed mousedown event but that s not what i m looking for obviously.Maybe i should combine two mouse events instead?
why don t you use empty string instead of null?, and your method will always return null since is not return a variable state.
tnx man, when you said "replaced" i automatically figured out that i should have done
while(!feof(f))
{
fscanf(f,"%c",&string[i]);
i++;
}
this, and then loop through but tnx for that snippet
int main(int argc, char** argv)
{
FILE *f;
char string[100];
int counter=0;
f=fopen("New Text Document.txt","r");
if (f==NULL)
{
printf("error");
}
while(!feof(f))
{
fscanf(f,"%c",&string);
}
fclose(f);
for(int i=0;i<100;i++)
{
if (string[i]=='a') /*doesnt work, why?*/
{
counter++;
}
}
printf("\n the number of vowels a is : %d",counter);
getch();
return 0;
}
the counter does not increment, i m not sure why.
I feel now kind of weird like my mind got erased in a second (started C at high school -.-) maybe because i m working in c# and now java for quite a time and suddenly switched to C and wondering where data type string is. Tnx @deceptikon
it came with the package
As it is said in the title i can not get the keyword string. I finally found a version of C for windows 8 but now i can t get the most important thing types int, double char,bool ect... work perfectly and always show as a keyword but somehow i can not get string.
import java.util.Random;
import java.util.Scanner;
public class DiceGame2 {
private static Scanner input;
public static void main(String[] args) {
// Declare variables for Scanner and Random
input = new Scanner(System.in);
Random random = new Random();
// Setup an array to hold the values from rolling one or two dice.
// Declare a variable to hold the user's input for rolls and dice.
// and another variable to hold the number generated by java.util.Random.
int[] frequency = new int[6];
int[] frequency2 = new int[6];
int rolls;
int dice;
int temp;
// Asks user how many die they would like to roll, then stores it in the variable dice.
System.out.print("How many dice would you like to roll, 1 or 2?\n");
dice = input.nextInt();
if(dice == 1) {
// Asks user for input on how many rolls they would like to make, then stores it in the variable rolls.
System.out.print("How many times do you want to roll the dice\n");
rolls = input.nextInt();
// for loop to go through the number of rolls user inputs.
for(int i = 0; i < rolls; i++) {
temp = random.nextInt(6);
frequency[temp]++;
}
// Display the number of rolls and results with a for loop.
System.out.print("Face\tFrequency\n");
for(int i = 0; i < 6 ; i++) {
System.out.println(i+1 + "\t" + frequency[i]);
}
}else
{
// Asks user for input on how many rolls they would like to make, then stores it in the variable rolls.
System.out.print("How many times do you want to roll the dice\n");
rolls = input.nextInt(); …
Please post some code, it s really hard to think without seeing the actual code
didnt you do that on your second post to this thread? Please provide new code if you ve changed your previouse code a be more specific, another thing that i can see in your code is that you re are reaching number 12 with the second dice, shouldn it be 6 again?
public static double[] calcCommissions(double[] grossSales)
{
double commissions[] = new double[grossSales.length];
for (int i=0;i<commissions.length;i++)
{
commissions[i] = 200 + 0.09 * grossSales[i];
}
return commissions;
}
try to substitute your last method with this.
In your last method calcComissions, you are using an array and you re not specifying on wich index of the array comissions the calculation that you re doing should go to, also you should check your index variable, you will get an error since it s not a public variable.
I would really appreciate some help here and some serious answers.
I work at a coffe shop and an man came up to me if i could charge his iphone (his battery was a 0%). He looked suspicious, i ve never seen him around the community. At first i was reluctant but then i decided to help him anyway. I plugged it to my computer where all the data is stored(reciepts,financial stuff, reports, investment data, everything which envolves coffe shop managment).
My question is. Is it somehow possible that he had an apllication on his iphone that once it s plugged in the app preforms a background work and collects the data without me knowing it and without seeing any proces on the desktop? If so can i actually verify if this was done with is iphone?
I m not a fan of apple stuff and apple software by that i don t have any knowledge on that topic.
The best thing to do in my opinion is to draw vertical columns , put the two players on the x coordinate and above each column the numbers of times they won, so try to increase a block(draw block like a square whic will acutally make a column at some time) by a defined unit when a person wins.
Is there any option which i can activate when using ECLIPSE so that when i m typing S... for String or i.. for int etc... to automaticly give me suggestions that i want a int if the first letter is i or i want a String if the first letter is S or anything else depending on what i m typing. I switched to Java since i m familliar with C# and VISUAL STUDIO gave me that choice and now i m quite insecure when writting some other built in methods or classes. I ve downloaded the Classic eclipse from the eclipse downloads url.
That s not really an easy task.You could somehow make a an array of characters with the tochararray method and then implement a for loop to go through each cell and check where x,y,numbers and math operators are and somehow accumulate this in a integer variable in c# there is a class for that and you can do it much easier for Java i suggest to take this code snippet from this Link:Click Here
let s say that you want squares and square roots, logarithms etc... then this would be fairly complicated to achieve but only using basic operators i think that this link should sort that out for you.
when the user inputs for example 2x+y, you then want it to be 2*xcor(enteredvalue)+ ycor(enteredvalue) or do you want to apply integrals to this equation since differetiantion is all about integrals. If you want to do the first thing then i would suggest to see check if the equation contains x and replace it with your xcor double variable, same for y.
Ok,i decided to create this with my own code so here you go,
if (ch == "4")
{
string hex;
Console.WriteLine("Enter a Hexdecimal Number :");
hex = Console.ReadLine();
int buffer = 0;
int num2;
int result = 0; // result is your decimall
int counter = 10;
for (int i = hex.Length - 1; i >= 0; i--)
{
if (int.TryParse(hex[i].ToString(), out num2))// if its a number
{
result=result+ (int)(num2*Math.Pow(16,buffer));
}
else //if it s a character
{
for (int j = 97; j < 103; j++)
{
if (hex[i] == (char)j)
{
result += counter * (int)Math.Pow(16, buffer);
counter = 10;
break;
}
counter++;
}
}
buffer++;
counter = 10;
}
Console.WriteLine(result);
}
i hope you ll be satisfied with it, you can t user uppercase letters if you want to use them make a method and code it by yourself, if you run into a problem feel free to make another thread. GOOD LUCK!
Well i can t help you right now, rushing to my class, i ll try to figure out what was your intention whith the ascii here,
by the way if you don t want make you own algorithms you can always use c# algorithms for example
Convert.ToString(Convert.ToInt32(hexavalue, 16), 10);
hex-dec
Well i suggest you again do some work and try a little bit harder, for instance, take a paper and do a conversion and then try to think how to code that. I know that it is a bit more difficult especially if you are a beginner but still. The whole point is that you think and think. Post the code again if you can t come up with a answer and im pretty sure that people will help you fast.
This thread is again a proof that in college or any educational institution will teach you something but that something is never applicalbe in real situation.
Lets get back to the topic.
I see you have an image on you hard drive i assume and the file extension is already .JPG. This means that the image has ALREADY been compresed! By that the imagesize (size in bytes) is always smaller. Of course the schema widthheightargb doesnt work here, it works only for .TIFF format the so called highest quality format which does not use compresion! If you right click on your image and select properties and to the math you ve done before you will again see that i does not match! So the size of the .jpg image will always be lower than the size of the .tiff image.If you now go and convert it to .tiff you will get a larger amount of bytes but again not the ideal amount of 7056000. I really don t know how to get to the original image size i mean it certainly possible but fairly complicated. Working with bits and bytes and expecting no loss is unchievable. By the way the whole idea is to get your image as small as possible in terms of bytes(keeping the quality) so i m not sure why you want extra memory.
I helped you and tried to figure out what you had in mind when doing it.Now you do the rest
if (ch == "1")
{
string binary;
Console.WriteLine("Enter the binary number");
binary = Console.ReadLine();
int power = 0;
int number = 0;
for (int i = binary.Length - 1; i >= 0; i--) // changed the ending state
{
if (binary[i] == '1')
number = number + (int)Math.Pow(2, power); // tried to figure out what you had in mind
power++;
}
Console.WriteLine("the decimal number is :" + number);
}
I m not sure what you want but first of all PROPERTY AutoSize does not exist (using 2012 VS).However there is a property called MultiLine and if you set it to true your text(string) will go down after it reaches the border of the textbox, it will go in the second line.
your while loop will run forever i don see any break inside, sorry i didnte see that you are still in the proccess of coding till you reach number 7 but still you should redesign you code structure since you have a local variable which is unreachable in the if statement and i think that even if your number you won t get the expected result.
can you post the code and the amount of bytes that it gave you?
thats correct if talking about argb rgb would be 24 bits in a pixel, in theory you can have as many bits as you want in a pixel.
Click Here
have a look at this link, download the stuff, if you can t solve the problem using this by yourself i ll help you out.
you have to concatenate, again
textBox1.Text = textBox1.Text+line;
change line 5 on your first post.
Why don t you use the streamreader class instead and i think at line 5 you want to do this
textBox1.Text = textBox1.Text+line;
but please give some more detalis cause i m not sure what you want exactly
The error is most definity the nullexcepction error, but i think that you should post some code..
how can i access it ?
The previous code will work but everything will be in the same line. If that bothers you then use this but still if retrieving a html i think that it shouldn t be problem but neverthless.
static void Main(string[] args)
{
string html_tag="";
int position1 = 0;
int position2 = 0;
string insert = "";
string text_to_put="Have a nice day";// whatever you want to replace the first string with
string document_path=@"D:\text\div.txt";
string input = "";
string concatenate="";
string pattern = @"<body.*?>(.|\n)*?</body>";//regex code, but not needed
using (StreamReader str=new StreamReader(document_path))
{
while (!str.EndOfStream)
{
input = str.ReadLine();
concatenate=concatenate+input; //instead of regex
position1 = input.IndexOf('<');
position2 = input.IndexOf('>');
if (input.Contains("body"))
{
for (int i = position1; i<=position2 ; i++)
{
html_tag = html_tag + input[i];
}
html_tag = html_tag + " ";
}
}
str.Close();
}
string [] array=new string[2];
array = html_tag.Split(' ');
concatenate=concatenate.Replace(concatenate,text_to_put);
Console.WriteLine(insert);
using (StreamWriter sw = new StreamWriter(document_path))
{
sw.WriteLine(array[0]);
sw.WriteLine(concatenate);
sw.Write(array[1]);
sw.Close();
}
Console.ReadLine();
//// we don t need this at the moment
//if (matches.Count > 0)
// foreach (Match m in matches)
// Console.WriteLine(m.Groups[0]);
//Console.ReadLine();
}
line 6 you should poot
bool
as well
static void Main(string[] args)
{
string html_tag = "";
int position1 = 0;
int position2 = 0;
string insert = "";
string text_to_put="Have a nice day";// whatever you want to replace the first string with
string document_path=@"D:\text\div.txt";
string input = "";
string concatenate="";
string pattern = @"<body.*?>(.|\n)*?</body>";//regex code, but not needed
using (StreamReader str=new StreamReader(document_path))
{
while (!str.EndOfStream)
{
input = str.ReadLine();
concatenate=concatenate+input; //instead of regex
position1 = input.IndexOf('<');
position2 = input.IndexOf('>');
if (input.Contains("body"))
{
for (int i = position1; i<=position2 ; i++)
{
html_tag = html_tag + input[i];
}
}
}
str.Close();
}
concatenate=concatenate.Replace(concatenate,text_to_put);
insert = html_tag.Insert(html_tag.IndexOf('>')+1,concatenate);
Console.WriteLine(insert);
using (StreamWriter sw = new StreamWriter(document_path))
{
sw.Write(insert);
sw.Close();
}
Console.ReadLine();
//// we don t need this at the moment
//if (matches.Count > 0)
// foreach (Match m in matches)
// Console.WriteLine(m.Groups[0]);
//Console.ReadLine();
}
i m sorry, but you could have seen that i put the .close() inside the while loop which gives an error, just put it outside the while loop
Just wondering how popular is Daniweb compared to other forums (if i may ask the question in this way)? If I type in google search anything that has to do with programming the first genereated result will be stackoverflow, i mean daniweb has a much more better design and organization and voting and marking threads solved ect... but the thing that beats daniweb is when you post a question at stackoverflow you get at least 3 decent responses in less than a minute. Do people at stackoverflow get paid for this stuff or do they do it voluntarily?
It would be nice if you could share your thoughts about my question.
hmm,could you please post some code so that we can see what s going on?
i really don t know where all the people have gone so i must do something
here you go try this, it s not using regex, actually linq with lamda is powerfull with this but this is a simple solution to it
static void Main(string[] args)
{
string html_tag = "";
int position1 = 0;
int position2 = 0;
string insert = "";
string text_to_put="Have a nice day";// whatever you want to replace the first string with
string document_path=@"D:\text\div.txt";
string input = "";
string concatenate="";
string pattern = @"<body.*?>(.|\n)*?</body>";//regex code, but not needed
using (StreamReader str=new StreamReader(document_path))
{
while (!str.EndOfStream)
{
input = str.ReadLine();
concatenate=concatenate+input; //instead of regex
position1 = input.IndexOf('<');
position2 = input.IndexOf('>');
if (input.Contains("body"))
{
for (int i = position1; i<=position2 ; i++)
{
html_tag = html_tag + input[i];
}
}
str.Close();
}
}
concatenate=concatenate.Replace(concatenate,text_to_put);
insert = html_tag.Insert(html_tag.IndexOf('>')+1,concatenate);
Console.WriteLine(insert);
using (StreamWriter sw = new StreamWriter(document_path))
{
sw.Write(insert);
sw.Close();
}
Console.ReadLine();
//// we don t need this at the moment
//if (matches.Count > 0)
// foreach (Match m in matches)
// Console.WriteLine(m.Groups[0]);
//Console.ReadLine();
}
do you really have to use regex for this?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Homework_task_F
{
class StudentDetails //class for Declarations
{
public string studentname;
public string studentsid;
public string studentgrade;
}
class Students
{
public List<StudentDetails> studList = new List<StudentDetails>();
//This list contains the student list
public int MaxStudents;
//This Function Adds the Record
public int AddRecord(string name, string sid, string grades)
{
StudentDetails stud = new StudentDetails();
stud.studentname = name;
stud.studentsid = sid;
stud.studentgrade = grades;
studList.Add(stud);
MaxStudents = studList.Count;
return 1;
}
}
class Program
{
static public Students theStudents = new Students();
//This method is to view Records as Report
static public void ViewRecords()
{
Console.WriteLine("__________________________________________________________________________");
Console.WriteLine("SNo Student Name SID Grade ");
Console.WriteLine("__________________________________________________________________________");
for (int i = 0; i < theStudents.MaxStudents; i++)
{
Console.Write("{0, -5}", i + 1);
Console.Write("{0, -15}", theStudents.studList[i].studentname);
Console.Write("{0, -10}", theStudents.studList[i].studentsid);
Console.Write("{0, -20}", theStudents.studList[i].studentgrade);
double Grade = Convert.ToDouble(theStudents.studList[i].studentgrade);
if (Grade >= 70 && Grade <= 100)
{
Console.Write("you Pass First Class \n");
}
if (Grade >= 60 && Grade <= 69)
{
Console.Write(" you is Pass Upper Second Class \n");
}
if (Grade >= 50 && Grade <= 59)
{
Console.Write(" you Pass Lower Second Class \n");
}
if (Grade >= 40 && Grade <= 49)
{
Console.Write(" you Pass 3rd Class \n");
}
if (Grade >= 0 && Grade <= 39)
{
Console.Write(" sorry you failed \n");
}
if (Grade >100)
{
Console.Write("Error \n");
}
}
Console.WriteLine("__________________________________________________________________________");
}
static public void InputRecords()
{
Console.Write("Student Name: \n");
string name;
name = Console.ReadLine();
Console.Write("Student SID: \n"); …
i copied and pasted your code and it s working quite OK. By saying that your code doesn t work are you reffering to the "Sorry you failed" output on the right side of the console?
i don t know if it s too early in the morning but i really don t understand what you want. Can you please be more specific
Tnx tinstaafl, if anyone else has any suggestion don t hesitate to write them down.
I ll give my best for this post not to be too long.
I would like to make a program for my colleagues, students so they can check their results when they finish there task or if they want to check results first and then give it a try (doesn t matter). I have a lot s of ideas on how i would to this(could have done it earlier but now i have a greater knowledge of C#).
There are 2 pictures as you can see and they practically explain everything. I would like from you guys to tell me how to do this, what should i focus on and what things do i have to have in mind not to mess up things. I must say that i really have a great knowledge of mathematics and i would like to use that knowledge as much possible it is. The first diagram(Q diagram) multiplies the force with the length of that force acting on the object(until the next force kicks in).The third diagram(Ms diagram) is actually done by integrating the first diagram so if you it just increments the function row by one(for example a line y=x will be y=x^2, the constant doesn matter here, the 1/2).This isn t a detailed explanation but i suppose that as soon as you see the pictures you ll know what i m talking about. The graph drawing technique is simillar to the one when you have a-t v-t,s-t diagrams in physics and …
The reference .Speech.Synthesis; does not exist in the library? How can i fix that
now i m really confused
I got 2 picturebox in my form which when I click on the 1st one I get 3 items in the listbox
i really don t understand this, what u are saying means that your image generates a list? In your first post you were talking about the inversive proccess were nt you? Please be more specific or post more code.
i found a website where there are plenty of words and i downloaded them to my project using the WebClient class and the DownloadString method inside that class.