C++ :: Music Program That Will Read Guitar Chord And Display It To User
Apr 28, 2014
I am writing a music program that will read (from a separate file) a guitar chord and display it to the the user. The format of the separate text file is as follows:
A
|--0--|
|--2--|
|--2--|
|--2--|
|--0--|
|--x--|
B
|--2--|
|--4--|
|--4--|
|--4--|
|--2--|
|--x--|
C
|--0--|
|--1--|
|--0--|
|--2--|
|--3--|
|--3--|
etc...
I want the user to be able to search for a specific chord in the file and how I can make that happen.
I'm trying to code a program to read the user's input and have it:
-count vowels -stop counting vowels after '.' or '?' (ie. abcdjwef is 1 a, 1 e; while fje.fwdfeiii is just 1 e) -closes when ENTER is pressed after a '.' or '?' is found (ie. closes after 'abacds. ENTER' as well as 'as.fefsdf ENTER') -display the number of vowels
Is there any way to do this with only 'cin >> userInput' and a while loop checking for punctuation?
I'm new to coding, and I have to write a program to display a class schedule to the user (the classes are entered into the program in strings like this:
in the format of an excel file (the user picks the classes they want to have) that then displays the course title and professor in the correct cell corresponding to the day/time the class meets. I've been googling it, and from what I've read, I think I need to use a csv file, but I don't know how to input the data into the file. I know the general format for how data is entered, but I don't know how to write it into a specific file or if I even have to (we covered txt files very briefly in my class, but never touched csv files).
So I'm trying to create a program that allows one to read/write on to output.txt. I though I had everything set up right, but its only writing one word to the text file. Heres the code.
#include "stdafx.h" #include <iostream> //Needed for User Input #include <fstream> //needed for ofstream #include <string> // needed for strings #include <windows.h> //needed for Sleep #include <cstdlib> //Needed for return EXIT_SUCCESS;
using namespace std; int main() { ofstream outputfile; //allows to read and write to files
[Code] .....
If I type Puppies Are Cute and go to output.txt, the only thing written in the text file is Puppies.
It's a tic-tac-toe program. I haven't finished doing everything I need to for the project, I'm just trying to get certain parts working as I go.
Anyway, my problem: The program will print the board and ask the first player which square they want to mark. Then it will print the updated board, print the question for the second player to input their square choice but not actually stop to let the user enter anything. Instead it prints the board again and then prints the question for player one again -- this time stopping to let them type in their choice.
Here's my code:
#include <stdio.h> // Function prototypes void printBoard(char board[3][3]); int main() { int quit = 0; // Loop so game continues until player quits
[Code] .....
And it looks like this when I run it, as an example:
write a program, pfpq.c, that maintains a priority queue of music tracks (songs) and ratings. The struct is given by:
Code:
struct track { char artist[20]; char title[20]; int rating; };
The program is only designed to demonstrate the concept so get the user to enter a small number of tracks and create a priority queue. (Use an empty string title or an empty string artist to end the program). Print the priority queue as it grows. Your program should initially ask the user if they wish to order the priority queue by rating in ascending order, or by rating in descending order, or if they wish to order the priority queue by artist name. Then build the priority queue accordingly. in the last case, "if they wish to order the priority queue by artist name." which is case 3. How do I sort the priority queue by artist name using in the following code.
how to read and display the content of a text file in my console application using C++. The file contains 25 lines and 3 columns. The first column is "Rank" (numerical values from 1 to 25) the second column is "Name" (25 teams name) and the third column "value" has the amount of point each team is worth. Looking for code for reading and displaying all this information ....
Write a program that reads from total.dat file and displays its contents to the console. The program should allow the user to add new entries to the file.
So far this is what I've got and I'm not sure if I even started right.
#include <iostream> #include <fstream> using namespace std; int main () { ifstream dataIn; ofstream dataOut; dataIn.open("total.dat"); cout << dataIn; return 0; }
I am currently working on a problem where I read a file into a 2D array, and display data. If you saw my code earlier, this is the same problem, but I am now further along.
The file (90 characters) looks like this: S R R S R R R R S S ....
The "R" resembles rainy days, the "S" resembles sunny days, and the "C" resembles cloudy days. There are 90 characters in the file. The first 30 are for the month of June, the next 30 are for the month of July, and the last 30 are for the month of August. The 31st day of the months are NOT included.
I read the data into a 3 x 30 array, where the row indicates the month (0 = June, 1 = July, 2 = August) and the column indicates the number of days in each month.
Now I need to create a function that creates a report and displays, for each month AND for the whole 3 month period: 1) The number of rainy days 2) The number of cloudy days 3) The number of sunny days 4) Which of the 3 months had the largest number of rainy days
Here is my code so far:
#include <iostream> #include <fstream> #include <string> using namespace std; const int MONTHS = 3;//Number of months
[Code] .....
There are no compiling errors, but I am not getting the data I want. My rCount and cCount variables end up being 0, and my sCount variable is 90.
What I need to do Is constantly read the cpu percentage and display it to a textbox, but the issue is I am using the windows form not the console so I cant use a while loop. I think my best bet is to use an event, but I am not sure how.
I'm supposed to read a text file and display it in the output. I have it down except my formatting. I just cannot get it to just skip one line rather than multiple. I know why though because my char has a max of 11 and if I put a character lets say mango, it is going to fill in the rest with white spaces. It's supposed to display like this:
Mango Strawberry Grapes
But instead I get something like this
Mango
Melon
Grapes
I am using isspace but it's not working.
//source code
#include <iostream> #include <iomanip> #include <cstdlib> #include <cmath> #include <fstream> using namespace std; class CFile
A problem that lets the user enter any positive integer, but you do not have to check for this, and then calculates the sum of the digits and displays this to user. For example, if user enters 14503, the outputted sum of the digits would be 13.
Here is my program
#include <iostream> int main(void) { int integer, sum=0; while(integer) { sum += integer % 10; integer /= 10; } cout << "The sum of the integers numbers is " <<sum; return 0; }
Program to read in 15 numbers and display them as follows //each number on a separate line
Code:
# include <stdio.h> # define MY_ARRAY 15 int main(){ int i ; printf("please enter 15 numbers
[Code] ....
Error that i get from compiler: Error E2062 array1.c 14: Invalid indirection in function main() Error E2062 array1.c 19: Invalid indirection in function main() both pointing to the separate "scanf"
If the user puts in a 6. I need the array to display the even number from 0 - 6. Right now what it does is it displays the first six even numbers. Okay as I'm writing this I'm starting to see where my problem might be..
Code: void sumIntegers () { int arr[50]; int i = 0; int num = 0; int sum = 0;
I am having problems printing "->" on the beginning of each line, im trying to do it as a loop and ending it when the user types "q". also i would like to know how to ignore text from the user when the input begings with a specific character. heres what ive done so far, and not currrently working as expected.
Code: #include <stdio.h> int main (void) { char prompt; printf("~~~ FRACTION CALCULATOR ~~~
I'm coding a hangman game. I'm trying to store user entries so i can output them to show the user what they have already entered. Problem is that it's not display anything at all.
I'm trying to store multiple characters of course, and then display all characters stored.
Create a program that will ask the user to enter a decimal value (1-999999) then display its corresponding binary numbers. Repeat this process until the value entered is equal to 0. Use the following Function Prototype:
void BinCodes(int value); Sample Input/Output: Enter a Decimal: 35 Binary: 100011 Enter a Decimal: 184 Binary: 10111000 Enter a Decimal: 0