Jump to content

Ointhedwarf

Members
  • Posts

    9
  • Joined

  • Last visited

Profile Information

  • Favorite Area of Science
    Physics

Ointhedwarf's Achievements

Lepton

Lepton (1/13)

0

Reputation

  1. Success again! Great, I managed to make a similar program but with sounds and now I can focus on more structural problems. Thanks again timo! This is the second program for anyone who cares /*PROGRAM : Note recognition*/ #include <stdio.h> #include <windows.h> #include <time.h> #include <stdlib.h> int main() { int r, value; char guess, A; printf("This program will test your ability to recognize notes by sound"); do { srand ( time(NULL) ); r = rand() % 7 + 1; if (r == 1) Beep(226,1000); else if (r == 2) Beep(293,1000); else if (r == 3) Beep(329,1000); else if (r == 4) Beep(349,1000); else if (r == 5) Beep(391,1000); else if (r == 6) Beep(440,1000); else if (r == 7) Beep(493,1000); do { printf ("\nFind the guess (A to G): "); scanf ("%c",&guess); scanf ("%c",&A); if (guess == 'A' || guess == 'a') value = 6; else if (guess == 'B' || guess == 'b') value = 7; else if (guess == 'C' || guess == 'c') value = 1; else if (guess == 'D' || guess == 'd') value = 2; else if (guess == 'E' || guess == 'e') value = 3; else if (guess == 'F' || guess == 'f') value = 4; else if (guess == 'G' || guess == 'g') value = 5; else if (guess == 'S' || guess == 's') { system("pause"); return 0; } if (guess!=r) printf("Try again"); } while ( value != r); puts ("\n\n\nCongratulations!!\n\n\n\n"); printf("\n Lets try again \n\n"); } while (guess != 'S'); system("pause"); }
  2. SPOT ON!! Ty man great job. But this makes me feel uncertain about things I thought I understood, I'll have to read some chapters again and do some experimenting. Now if you don't mind I'd like to take this program to the next level and by this I mean adding sound. So I'd probably need a function that makes a sound when given the frequency, or simply a function that imports files to the program. This would be implemented to the program by giving to each function the random number and using a similar sequence. Now I have no idea how to do this, I've found some reference about a beep function but I don't know if my compiler supports it or if I have the correct library...
  3. I see, by using C++ it becomes quite simple. I actually understand the format without any knowledge on C++ programming. I was thinking of switching to C++ before I get to deep though I'm still curious about how you would tackle this problem in C. Thanks a lot! My first problem will be evident if you try it out. For some reason after the first try a problem occurs, I will not try to explain it but I'll give you an example. -Program starts. -Prints a staff. (lets say its a C) -The user types in a, he is asked to try again like this Find the note (A to G): Try again Find the note (A to G): | (<- blinking) So the program ran the if function and started again from the second do command, no problem here. -The user types in c, the program prints a new staff Now if the note of the new staff is something other than C for some reason the if function is ran prematurely an instead of this Find the note (A to G): | (<- blinking) you see this again Find the note (A to G): Try again Find the note (A to G): | (<- blinking) My guess is that the value of the 'note' variable (or as you aptly changed it 'guess' variable) is considered different from the 'truenote' variable and the if function runs prematurely. Try it out and you'll see PS The parts I've coded are supposed to be the console
  4. Oups sry I meant staff not pentagram..
  5. First I must say that I'm quite a newbie in C programming.I've made the following program for practice with note reading: http://www.dpaste.org/3V2fc/ As you can see the idea is: 1) to produce a random note on a staff. Simplest way is making it visual and shaping it by using lots of these - and O for the note. The randomness is achieved by placing a number to each staff (i.e. note), and running a random function covering each possible note/number. At the same time in each staff the note determines the value of the variable 'truenote'. 2) to ask the user to find the note. The user can type in the notes A,B,.., G and for each note a number is given to a variable 'note'. 3) to verify the answer. The program compares the value of the variable 'note' with the value of the variable 'truenote'. If the answer is correct the whole sequence is repeated from start. If its wrong only the user-part of the program is repeated. 4)When the user presses 's' the program prints the number of tries and errors and then ends. There are a number of issues with this program which I can't solve. The first has to do with the program as it is and I believe its a logical problem, if you try the program out you'll find that after the second try the previous value of the 'note' variable runs the if function and a standard message is printed in the start of each try. This affects the value of the errors variable making it practically useless. The solutions of this program is, either finding the logical problem , or un-assigning the value of 'note' in the end of the loop. Both I dont know how to do . The second optional problem is that I dont know how to allow answers like do re mi fa sol la si.. I know its because of the char variable 'NOTE' but I dont know how to use arrays in such a fashion. Thanks in advance! PS. Scroll all the way down to pass the printing in the beginning
  6. Ok I see what you mean, lets stick to the basics. Classical Mechanics, Waves, Statistical Physics, Introduction to Astrophysics, Hamiltonian Mechanics, Modern Physics, Introduction to Quantum Mechanics, Special Relativity.
  7. Yes you're probably right.. What I mean to find is textbooks concerning particular fundamental fields. You may have different opinions on what is considered fundamental but I'm talking about fields like Classical mechanics in physics or Statistics and Probability in Maths. For example concerning Classical Mechanics I've perused both Alonso & Finn's and Serway's books and in my opinion Serway's style is mostly problem solving while Alonso & Finn's is more about the nature of laws and equations. I find both of them useful for different reasons but neither has made me want to actually read the book from start to finish like I felt about Griffith's book.. So I'm really looking for books that have caught your attention, concerning such fields, and the reason you would prefer those books in place of others. Hope that helped
  8. Ok I find it quite strange that after 1,633 views nobody had anything to post.. Maybe you have misunderstood my post. I'm simply asking your views on textbooks, mainly physics, that you have found especially useful. For me the points in electromagnetism are almost covered by Griffith's book for example, have you experienced something similar?
  9. Hi, I'm new to the forums and I need help finding certain books or rather books with particular knowledge prerequisites and handling of the subject. I can only offer examples of such textbooks to make my point and those are David J. Griffith's Introduction to electrodynamics or Mardsen-Tromba's Vector calculus. These books treat fundamental subjects of science starting with basic mathematical knowledge and later advancing to especially complex problems. I'm not sure if this is a question of.. taste, but these two have fulfilled my demands greatly mainly because of the way they treat the subjects by slowly evolving from simple problems. Concerning the subject of these textbooks I'm mainly looking for physics textbooks (since that's what I'm studying) though books on related fields, namely mathematics and chemistry, are also desired. What are your thoughts? What books would you recommend? Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.