C++ :: How To Generate Sounds Of Mixed Waveforms

Aug 23, 2013

I have used beep() and sound() functions. But both of them generate sounds of only fixed frequency. Is there any way i can generate a sound of mixed waveforms. I am currently using this code, but it isnt reliable at all times and for all frequencies,

for(i=0;i<500;i++)
{
sound(500);
delay(2);
sound(250);
delay(2);
}

View 19 Replies


ADVERTISEMENT

C++ :: Drumpad - Where To Get Sounds

Jun 25, 2013

I am making a drumpad program so where to get the sounds.

View 5 Replies View Related

C++ :: API For Playing Sounds On Console Application

Aug 8, 2013

I'm thinking of making a horror text-based game, which would use sounds, if you could also tell me of an API to display images in an alternate window that would be nice.

View 6 Replies View Related

C++ :: Sorting Array Of Mixed Float?

Oct 25, 2014

I should sort an array of mixed float and integer numbers by merge method, and using the pointers to sort that mix array. how to use pointers to sort those different type of data.

View 19 Replies View Related

C :: Mixed-type Contiguous Memory Buffer

Mar 1, 2014

I'm writing a program that communicates with another program over TCP/IP. I need to assemble contiguous buffers of mixed data to send to the server. For example, one of the messages must contain multiple 32-bit integers and 64-bit floats, each in its own appropriate field. I also need to receive and decode similar buffers.

The Windows TCP function "send(socket s,char *buf, int len, flags)" takes a pointer to a character array to send. Likewise, the TCP function "recv(socket s,char *buf,int len,flags)" takes a pointer to a character array to fill. I've tried creating structures describing the send and receive messages, with the fields appropriately laid out. But the CODE::BLOCKS compiler complains when I try to hand send and recv the pointers to the structure variables. Am I on the right track, or is there a better way to do this?

View 2 Replies View Related

C++ :: Mixed Expressions / Loops And Formatted Output

Feb 22, 2015

1) ask the user to input a mathematical expression in the following format:

NUMBER Operator NUMBER Operator NUMBER
Example: 17 + 15 - 3
Example: 2 * 3 - 4

How to output the answer of the users equation. Is there a function that includes all math operators (+,-,/,*)? Would i need to write each possible scenario using if statements?

View 2 Replies View Related

C++ :: Reading Mixed Data Types From A File

Mar 28, 2015

How to properly read data from a .txt file.

If I have data stored in a .txt file, which is formatted/stored like this:

Code:
Apples and Strawberrys
10
Cherrys
12
Pears
16
Grapes, Melons, and Peaches
20

I know that if I read/extract, and print the data like this;

Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
ifstream dataFile("test.txt");
string textData;
[Code] ....

Each line of data is stored in the string "textData" and printed to the screen, exactly as it was stored in the .txt file. So, all is clear to me up to that point.

But, what if I wanted to store each line of text in the string "textData", and store the numbers/integers into a separate variable called "numberData"? How would I retrieve and store the numbers (in the above example .txt file, every 2nd line) separately from the text?

For now, to keep things simple, let's assume that the data in the .txt file is stored/formatted as in my example (1 line of text, 1 line containing a number/integer, ...repeat) so, there is no need to test if the retrieved data is actually text or an integer, before it is stored in the appropriate variable type.

View 14 Replies View Related

Visual C++ :: Reading Into Array / 2d Array From Mixed Text File?

Jan 18, 2014

I know to read a strings into array and tables.. what is they are mixed up?? strings are just names ( 3 characters) and there are bunch of table.. the max size was set to 60

ex. text file

JES
DAN
JEN
.
.
.
01010101
10010101
RAM
JET
01010010
10100101
.... and so on

should i use a while loop?

View 10 Replies View Related

C :: Generate Random Numbers

Mar 17, 2013

I'm trying to generate random numbers so that I can assign people to teams. So far I have come up with this

Code:

int generateTeam(){
int i, teamNumber, c, n;
for (c = 0; c <= 5; c++) {
n = rand()%100 + 1;
}

[code]....

}//end generateTeam I'm not sure how to make it so that I can exclude the previous random number when generating the next one. As an example, I have 22 students and I get the number 19. Now I can't have 19 again because that guy already has it.

View 3 Replies View Related

C :: How To Generate Real Number Between 0 And 1

Mar 1, 2015

I am a very very beginner at programming with C. Well, basically i have to generate a real number between 0 and 1 (which as the same as from 0 to 100 k and than dividing everything with 100 k).

Why I am constantly talking about 100 k? Because I would need approx 50 000 random numbers between 0 and 1. My code currently looks something like this:

Code:

int main(int argc, char** argv) { int min,max;
double number;
srand((unsigned)time(NULL));
number = 1 + rand()%100;
printf("The number is: %lf",number);
sleep(2);
return (EXIT_SUCCESS);
}

And If I am not mistaken, should generate numbers between 0 and 100. But I can't figure it out how to change to code in order to get enough numbers.

View 4 Replies View Related

C :: Loops That Would Generate Same Results

Nov 20, 2013

Using loops that would generate the same results. I need to use a loop that would make the syntax less lengthy ....

Code:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<iostream>

float check(float s);
void load(float*);

[Code] .....

View 2 Replies View Related

C :: How To Generate Hash Table

Jul 29, 2013

Code: I have these two columns.

ID Group
0 2
1 2
2 3
3 4
4 4
5 4
6 4
7 4 Code: I want to store ID values on the bases of same Group, like we do in Hash table (key, value) .

Group ID
2 0,1
3 2
4 3,4,5,6,7

so when i said key 2 it will give me 0,1. how can i do it. As first i thought that i can use array of array but then how i can store the value of key. Now I am thinking of hash but i don't know how I will store and retrieve these values.

View 5 Replies View Related

C :: How To Generate DLL File In Eclipse

Nov 16, 2013

I just re-installed my OS some days ago,which contained Visual Studio.But I don't want to use the VS any more(at least in my computer) as the interminable installing process.Then I take Eclipse as my C/C++ IDE by MinGW and CDT. My Java program need to load an DLL file which wrote by C.But when I generating the DLL file,I got some errors.It seems that the compiler cannot find the header files. By the way,I just want to implement the hello-world program in C and invoke it in the Java program.This is my Java testing program:

Code:

public class HelloWorld{ public native void printHelloWorld();
static{
System.loadLibrary("hello");
}
public static void main(String[] args){
new HelloWorld().printHelloWorld();
}
}

And this is the header file generating by "javah HelloWorld":

Code:

/* DO NOT EDIT THIS FILE - it is machine generated */#include <jni.h>/* Header for class HelloWorld */
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
#ifdef __cplusplus
extern "C" {
#endif

[code]....

View 1 Replies View Related

C :: Generate Random Number Between 50 And 200

Oct 15, 2014

I'm trying to write a program that generates a random number between 50 and 200. I made a program that generates random numbers, but how to make those random numbers be in-between 50 and 200. Any example of a program that generates random numbers that are confined in-between certain values?

View 1 Replies View Related

C++ :: Generate Two TXT Files In One Program

Apr 4, 2013

I try to write my data into two different files and i just use something like this

ofstream myfile;
myfile.open("phase 1.txt");
if (myfile.is_open()) {
for(i=0;i<M; i++)

[Code] ....

But it only generate the first file. How should i modify this?

View 3 Replies View Related

C++ :: Generate All Permutations Of A List?

Dec 5, 2013

I know how to generate all permutations of a list like: {'h','e','k','p'}

But I am needing to know how to generate all permutations like: {{'a','b'}, {'h','k','d'}, ..... } such that the first character is either an 'a' or a 'b' and the second character is one of the three in the second list, etc. There will be less than 600 000 permutations.

View 3 Replies View Related

C++ :: Generate Two Arrays From One Big Array?

Oct 12, 2014

I am trying to generate two arrays from one big array, of which the sum of the 2 array's elements are as close to equal or equal to each other if possible, or one array summed up minus the second array summed up will be as close to zero as possible. I start with int array of 30.

It says that the lowest possible combination of one array minus the other is 239 which I know is not true. Also this needs to run in under ten minutes.

#include <iostream>
using namespace std;
const int size = 30;

[Code]....

View 4 Replies View Related

C# :: How To Generate Random Word

Mar 6, 2014

I just can't seem to get this right. What I want to happen is when the program runs a random word should pop up.

I have included my code. I'm not sure by putting tag around my code.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;

[Code].....

View 4 Replies View Related

C# :: How To Use Code Or Generate DLL In Matlab

Feb 20, 2014

I have an application thats has been coded in C#. After build it generates a standalone dll file and the exe file.

I want to use this code in Matlab. I found out from this page that I can load the C# classes or codes into Matlab.

dll_in_matlab = NET.addAssembly('location to the dll file)

I have the code and the application buty unfortunately I do not understand C# at all. So after using this command I was able to see a .NET object in my workspace and this is what I got for its properties and its classes:

evmaps =
NET.Assembly handle
Package: NET
Properties for class NET.Assembly:
AssemblyHandle
Classes
Structures
Enums
GenericTypes

[code]....

This is the application it produces: [URL] and here is the virustotal result for my application just to ensure that its clean. [URL] .....

View 1 Replies View Related

C/C++ :: Generate Prime Numbers Up To N

Oct 22, 2014

Given a number "n" supplied by the user, write all the prime numbers less than or equal to "n"

not at all how to make the number I enter me for the numbers that I need even a couple makes the prime number if the command is used repeat for but and decision making but the truth is that I can think of no way to do for this exercise is that the prime numbers are those numbers which are divided only by 1 and themselves also

until the moment I have this code

#include <stdio.h>
#include <stdlib.h>
main(){
int n;
n=0;
printf("enter the desired number: ");
scanf("%f",&n);
system("pause");
}

View 5 Replies View Related

C++ :: Generate Random Numbers To A File?

Apr 3, 2013

The program is to generate random numbers to a file and will have one integer parameter, Open a file and then using a loop write the required number of random numbers to the file. Scale the random numbers from 1 and 100 inclusive. Then closes the file .The last function will read the numbers in the file into your program. so far i have

Code: #include <iostream>
#include <string>
#include <iomanip>
#include <ctime>
#include <fstream>
#include <cstdlib>

[Code] .....

View 12 Replies View Related

C++ :: Generate List Of Tokens For A Query

Jun 9, 2013

I'm trying to solve the following problem:

Given a query, find all possible tokens, i.e. query-splits

Example:
query = New York Hotel
tokens = {New, York, Hotel, New York, New Hotel, ...., New Hotel York, Hotel New York, ...}

Given a query with word count n, the total number of tokens is:
n + n*(n-1) + n*(n-1)*(n-2) + ... + n! (any explicit formula available for this sum?)

Now, I have came across various code snippets to generate permutations for a string, but never for a sentence.

View 13 Replies View Related

C :: Generate And Print Subsets Of A Group

Dec 13, 2014

I'm a beginner in C programming and I've got a task that can't finish it..I'm supposed to generate and print the subsets of a group that its size I should enter. Pointers are not allowed!!

View 1 Replies View Related

C :: Program To Generate A Random Sentence

Oct 31, 2013

so I'm creating a program that generates random sentences with structs..I'm trying to use structs and and create 4 different groupings article, noun, verb, and preposition. Then I'm trying to use "r = rand() % ;" to randomly pick one one word from each group to make a sentence. this is what i have

Code:

typedef enum article {
the = 1, a, one, some, any
} article;
typedef enum noun {
boy = 1, girl, dog, town, car
}

[code]....

View 5 Replies View Related

C :: How To Generate Random Color Names

Sep 7, 2013

I want to print different color names for "nb " times . I get the number " nb " from the user or from text file . if " nb = 3 " then I want to print any 3 different color names which means that I may print ( red , green , blue ) for example . and if " nb=5 " then I have to print any five different color names ( pink , blue , black , red ,white ) fore example .

Note : " nb " may be a large number ( 17 for example ). How can I do this ?

View 2 Replies View Related

C :: Can't Generate Number In Random Function

Jun 16, 2013

i just search random function, there are random function using rand();but when i compile this code

Code:

#include <stdio.h>
int main(){
int a;
a = rand();
printf("%d",a);
}

[code].....

i ask to you that is function to generate the number, why the number is cannot generate

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved