49,761 Topics

Member Avatar for
Member Avatar for charleneok

Anyone know how to do this question? Use recursion to implement the following recurrence relation f(x): f(x)=1 where =1 f(x) = f((x+1)/2) +1 where x is odd f(x) = f(x/2) +1 where x is even This is what i did: [CODE]#include<stdio.h> int func (int x) int main() { int x; …

Member Avatar for selina12
0
202
Member Avatar for gary91
Member Avatar for ladybug21

//I have this running but when the user inputs a different character than the program just out puts the error //message and that its. I want it to go back and ask the user if they would like to run the program again. Any //ideas? Thank you! [CODE]int main () …

Member Avatar for mzimmers
0
263
Member Avatar for express690

I'm having trouble writing an array program that deletes duplicate numbers in an array. I can't figure out the code for find the array size. I have the array max set to 25 but my array doesn't have 25 numbers in it. (let's say it only has 10 numbers in …

Member Avatar for WaltP
0
333
Member Avatar for phorce

Hello I'm trying to display the memory location(s) of an array of pointers. It works, but it prints the memory locations out as: e.g. [code] (0x7fff672e19a0) [/code] I know that is the memory location, but in other examples, I've seen it being displayed as [code] 4041 [/code] Here is the …

Member Avatar for L7Sqr
0
121
Member Avatar for triumphost

Hey guys I'm here again with another problem. I want to search in a string for a string with quotes in it. Example: [CODE]String to search = {' </a></div></div></div><div class="clearfix"><table cellspacing="0" class="wsod_quoteData"><tr><td class="wsod_last wsod_lastIndex" nowrap="nowrap" '} What to search for = {' <table cellspacing="0" class="wsod_quoteData"> '} Then if found, from …

Member Avatar for triumphost
0
170
Member Avatar for crownedzero

Using strings [CODE] #include <iostream> #include <string> using namespace std; string replaceSubstring(string, string, string); int main() { string string1 = "the dog jumped over the fence", string2 = "the", string3 = "that", newString; cout << "This program will replace a keyword in a sentence with another word.\n\n\n"; cout << "Our …

Member Avatar for mzimmers
0
2K
Member Avatar for Firzin

So I have question regarding a program I need to write. I need to read a text file which consists of a location and the coordinates of it's longitude and latitude. The program should be able to read any amount of spaces and tabs in between the tokens. So it …

Member Avatar for mzimmers
0
184
Member Avatar for phorce

Hello, I am working on a script that reads each individual character from a txt file and then outputs it depending on whether it's in the alphabet or not.. The problem is, it won't output spaces or anything apart from the string.. e.g. The text file reads: [code] Hello, my …

Member Avatar for Red Goose
0
105
Member Avatar for PixelExchange

Hello all. I've been trying to create a paintbrush with win32, but to no avail. The best that I've been able to do is plot a few pixels here and there (with SetPixel(), but never in a straight, seamless line (the way the pencil tool works in Microsoft paint for …

Member Avatar for jackmaverick1
0
110
Member Avatar for maynardjk13

Hi! I'm almost done with this program, but I have a problem: Whenever it displays the prime numbers, it throws in non prime numbers that are odd (like 9 and 15) Here is the code so far. [CODE] /* File: isprime.cpp Created by: Ricardo Renta Creation Date: 11/8/11 Synopsis: This …

Member Avatar for mrnutty
0
250
Member Avatar for pkrdimos

Hi all, As the title says, I have to create a C++ program (for my thesis) that will solve all the motion equations and have a graphic of the moving engine system. I've done all the "heavy" lifting but I am stuck on the graphics part as I haven't work …

Member Avatar for mrnutty
0
199
Member Avatar for That_Dude

Hi, all. I am a undergraduate computer engineer major, and I am currently learning Bode plots. I am very fluent with C++ but have been out of the game, as far as creating something goes. I am looking to implement a program that can construct a Bode Plot. A bode …

Member Avatar for mike_2000_17
0
718
Member Avatar for alarifth

Hi everyone! When i compile my small piece of code it gives me the error [COLOR="Red"]C2512 : No appropriate default constructor available[/COLOR] this is my definition of class person: [CODE] // Person.h // A class defining a person #pragma once #include <iostream> #include <string> #include <functional> using std::cout; using std::endl; …

Member Avatar for mzimmers
0
9K
Member Avatar for slygoth

In this code i would like to store the values that are being outputted. [CODE] fstream filestr; char check[4]; filestr.open("D:\\bio.pdf", fstream::in | fstream::binary); if(filestr.is_open()) { int i; char check[4]={0}; for(i=0;i<4;i++) { filestr.read(&magic[i],1); [COLOR="Red"]cout<<hex<<static_cast<int>(check[i])<<endl;[/COLOR] //<-- This LINE } } [/CODE] The numbers that are printed here i would like to save …

Member Avatar for slygoth
0
105
Member Avatar for avgvstvs

I have just completed my first program in c++.I am an ultra newbie,have only been doing c& c++ for 12 days,so please forgive me if my program is shit.Anyways i would like the experts on this forum to evaluate my work and give me tips and hints to make myself …

Member Avatar for avgvstvs
0
333
Member Avatar for BlackRocker

Write a program that uses two parallel arrays to store student names and their grades. It should use an array of strings that hold the names and a two-dimensional array of integers for grades. Use nested loop to add individual student grades and get the average grade of each. The …

Member Avatar for BlackRocker
0
200
Member Avatar for jdh1231

So, I am suppose to make the bar chart looking like the picture attached below using Array and for loops. It suppose to output a bar chart (using "*") of temperatures for the hours. Range of temperatures should be from -30 to 120. Each * should have amount of 3 …

0
135
Member Avatar for varun.sharma

I made a code(test1.cpp) from an existing code of a game (ramble_shuffle.cpp) using classes...but the code gets stuck somewhere...Iam unable to find the fault...can some1 find please...the code hangs up.... Original game code : shuffle_game.cpp my code : test1.cpp

Member Avatar for mrnutty
0
47
Member Avatar for Arjunah

This is a program which i am making of a quiz in which there are lifelines for helping the user solve his question. this function is to chose from whichever lifeline the user wants to chose. but my problem is that it is not inputing the string i.e not using …

Member Avatar for WaltP
0
178
Member Avatar for user543820

hi! i want to move a character A on the screen by using arrow keys. i know that there are 25 rows and 80 columns.i take a character input as follows: char input; cin>>input; int put=input; here, the ascii value of input goes in put. i am using the ascii …

Member Avatar for Ancient Dragon
0
919
Member Avatar for beaute

I have the following piece of code which I'm trying to understand. I know what this code does, but I don't get what each element mean. Can somebody please explain it to me? [CODE]typedef int(__stdcall * pICFUNC)(int, int); pICFUNC add; add = pICFUNC(lpfnGetProcessID);[/CODE] Basically, this code allows me to prototype …

Member Avatar for Ancient Dragon
0
152
Member Avatar for Dakot

hello , i made a election program , here it is [CODE]#include <iostream> #include <cstdlib> #include <string> #include <conio.h> #include <iomanip> #include <fstream> using std::ofstream; using namespace std; string users[4]; char choice2; int votes[100] = {0}; int choice; int totalVotes=0; void votes1() { cout<<"Voting! : "<<endl; cout<<setw(21)<<left<<"(1) To vote " …

Member Avatar for StuXYZ
0
181
Member Avatar for maynardjk13

Hello! I was given the following problem: Define the function f(x; y) as: f(x,y) = sqrt(x^2-y^2) Write a program that produces a table of f(x, y) for integers x and y from 0 to n where y <= x. The value of f(x,y) appears in row (x+1), column (y +1) …

Member Avatar for selina12
0
164
Member Avatar for Basteon

So, I need to make a program that draws a [URL="http://en.wikipedia.org/wiki/Automata_theory"]finite automata[/URL] from the input data. I had some experience with the [I]graphics.h[/I] header but as far as I know it's a Borland only header and VC++ doesn't support it. So I was wondering, is there a way to draw …

Member Avatar for sathishraji
0
1K
Member Avatar for ChaseRLewis

The below code gives an output of: [CODE] Allocated! Allocated! Deleted! Allocated! Allocated! Deleted! Size: 3 Capacity: 4 vector[0]: isAligned! 20 30 40 Deleted! Deleted! [/CODE] Can someone explain the first allocation and why there are 4 allocations instead of 2 (one for each reserve?). I figure the first is …

Member Avatar for vijayan121
0
148
Member Avatar for TheNNS

Basically I need to read from a text file that looks like this customer Kevin checking myaccount 100.00 bond mybond1 1997 100 0.07 bond mybond2 2010 200 0.01 irabond myirabond1 1997 100 0.06 end customer Mark irabond hisirabond1 1999 200 0.08 bond hisbond1 1990 2000 0.10 end I need to …

Member Avatar for vijayan121
0
220
Member Avatar for kkreisler

I have an assignment to write a program that builds an array Usize determined by user inputs m,n. the hangup is that the first element in each row or column is equal to the number of the row or column,and all the elements inside are to be the value of …

Member Avatar for mrnutty
0
104
Member Avatar for sharkfan69

I'm having trouble figuring out why my extractMax function isn't working correctly. I'm reading from an input file that looks something like this: [CODE](arule, 12), (brule, 21), (zrule, 70), (drule, 25), (erule, 10) (frule, 3) (grule, 20), (srule, 100)[/CODE] It should read the priorities into an array, build the heap, …

0
51
Member Avatar for dmr1775

Hey all I have a program that I have been working on and am having some trouble with keeping count of all the users grades. I know that now I am only counting the last grade earned for each category but I want to know how to keep count of …

Member Avatar for WaltP
0
206

The End.