49,757 Topics

Member Avatar for
Member Avatar for infernojmd

so i been using i/o streams and i understand how to open, check to see if file fails and close files but i cannot understand how to change it to something new i g2 do these, Change dashes to spaces. Change all characters to lowercase. Change digits to * (asterisks). …

Member Avatar for Ancient Dragon
0
95
Member Avatar for lolodede

Write a C++ program that reads from keyboard 3 words, with proper input prompt. Then for these 3 words that were read, the program displays first the word of the longest length, then the word of the shortest length, and finally the remaining last word. You may assume that these …

Member Avatar for ivailosp
0
249
Member Avatar for jiah

Hi guys! I'm beginner on the scene and I'm trying to make an ascii maze game. I have managed out how to get the character to move and how to make a goal where to go. But now I have faced a problem...the walls. I'm not sure how should I …

Member Avatar for TMD
0
493
Member Avatar for roachic

Hi everyone. I was wondering what is the best way to check if a text file is empty? When I read from a text file: file.Open(path, CFile::modeRead); And then try to access it: file.ReadString(line) I get an error.. I have tried if 'file.end' but file.end returns true every time so …

Member Avatar for roachic
0
147
Member Avatar for oneguy

Any hints in converting this C++ code to java [url]http://pastebin.com/f2db2b32e[/url] I have pretty good idea what is going on in main () , but I not sure about the top template part and the class called Moron :) The program just reads a text file counts up the frequency of …

Member Avatar for Ezzaral
0
106
Member Avatar for Arne Kristoffer

Hello! I have a string which may look like this: (arne kristoffer)(1231232)(12.12.12)(asdasdf 12) This is just an silly example, but never mind. THe point is that i need to seperate the contents of the string into a string vector. This is my code (which of course doesn't work, if it …

Member Avatar for Lerner
0
146
Member Avatar for Rotvailera

[B]help me with this program :[/B] [code=cplusplus] #include <iostream> using namespace std; #include <math.h> double F(double x){ double res = pow(x, 9) - pow(x, 7) + 2 * pow(x, 2) -1; return res; } void print_roots(){ double low = 0, high = 1; for(int i = 0; i < 1000 …

Member Avatar for Lerner
0
70
Member Avatar for brianvolkmann

[code=cplusplus] #include<stdlib.h> #include<stdio.h> #include<conio.h> #include<string.h> #define ff fflush(stdin); void main() { int r; char str1[10], str2[10]; clrscr(); printf("Enter password:\n"); gets(str1); ff; printf("Re-enter password:\n"); gets (str2); ff; r=strcmp(str1, str2); if(r==0) { printf("Enter"); } else { printf("Exit"); } getch(); } [/code]

Member Avatar for Nick Evan
0
151
Member Avatar for Jennifer84

Here I am putting 2 Number into a std::vector<double> and sort these numbers like this. When putting Number1 and Number2 wich are declared variables into the vector, the Number 5 and 10 are put into the vector. If I after the sort write this: Numbers[0], this will give me the …

Member Avatar for Jennifer84
0
256
Member Avatar for CoolGamer48

[CODE] ResourceManager(void (*CreateResourceFunction) (Type** resource, char* name, char* path) = NULL) { m_list = new LinkedList<Type>; CreateResource = CreateResourceFunction; }[/CODE] hey - this is code for a contructer for a class (taking the code from a book I bought). What exactly is the parameter of the function? Is the parameter …

Member Avatar for Salem
0
90
Member Avatar for roachic

I want to read a file which is in the same folder as my program. What is the notation to get the current folder? I tried '.' but it doesn't work.

Member Avatar for roachic
0
94
Member Avatar for Trckst3

Hi guys I'm new here and basically new to programming. Unfortuanetly i'm probably gonna be quite annoying to you just because you guys know what you're doing and I'm like the little slow train that's trying to catch up. Though hopefully you'll help... Here's my situation I'm supposed to write …

Member Avatar for ivailosp
0
97
Member Avatar for kiwihaha

This program is a simple bejewel game... i need to enter the matrix pos[alpabet][number]...eg(a1 or b7) so if i error input for example: 11 (cout error) this can work aa (cout error) but this will infinite loop... please help me... besides some one can tell me what can i do …

Member Avatar for Ancient Dragon
0
97
Member Avatar for cute121180

Problem statement: The program has to take input for DFA and for h() function that is for homomorphism. I am able to write the program in C++ only for DFA. I am unable to include the h() function. Moreover, my DFA program giving me an error. [code=cplusplus] #include <iostream> #include …

Member Avatar for cute121180
0
187
Member Avatar for Arne Kristoffer

Hello! :) I'm having a problem while comparing one character from a string with a ... string. This is a part of a pretty complex loop (or, it's complex for me, since I'm new to C++ and programming), but the case is that I need to compare the value of …

Member Avatar for Arne Kristoffer
0
22K
Member Avatar for ulrik04

I've made this Supaplex-like game, but I have a problem. I want to have more levels, so I've made that when moving to the next level, it clears the vectors with all the objects, and putting new objects into. this is my code for moving to level 2: [code] void …

Member Avatar for ulrik04
0
108
Member Avatar for Rotvailera

Hello. First sorry for bad english. Can somebody help me with this: Using Bisection method find one real root for f(x)=x^9-x^7+2x^2-1 xE [0;1] I have to write a program in c++ witch founds me the root. Please help me. Again sorry for the bad english

Member Avatar for Rotvailera
0
101
Member Avatar for nurulshidanoni

[B]exam TStu TExam [/B] 1 91 25 2 168 20 3 2080 46 4 680 56 5 15 12 6 680 22 7 166 20 How to sort in descending order like this.. 4 680 56 3 2080 46 1 91 25 ....................................

Member Avatar for Ancient Dragon
0
110
Member Avatar for xsoniccrackersx

Hi all, I'm new here but I am in need of some desperate help. I have a program that works perfectly but here is the problem: I cannot use the function getline to get a line in the input file and turn it into a string to be manipulated by …

Member Avatar for xsoniccrackersx
0
1K
Member Avatar for Kaushalya

Wish you all a good day.Currently i'm working on c++ project.I want to know how to convert string object to a character array.Also why ifstream object doesn't accept a string variable as follows, void split(String filename) { ifstream ifile; ifile.open(filename);//this fails }

Member Avatar for VernonDozier
0
100
Member Avatar for obsolucity

I am having trouble with this assignment and was hoping I could get some help. I am not sure whether or not the output for my decomposed, unsorted, and sorted lists are correct. I'm not sure how to interpret the data in order to help justify why the big-o estimate …

Member Avatar for Laiq Ahmed
0
313
Member Avatar for nedimavci
Member Avatar for lizhiyuan

dear all any one know howt to use openGL with vc++? i encountered some problem.thanks a lot. why glRectf(x1,y1,x2,y2) can draw a rectangle, here (x1,y1),(x2,y2),just two points,anone can exsplain to me? thanks. sorry to ask such question.no choice!

Member Avatar for Nick Evan
0
146
Member Avatar for TSharma

please send me some examoles of implementing str stream. i am trying to understand it but i could not find proper source in the net. what does str() do??

Member Avatar for Laiq Ahmed
0
91
Member Avatar for mod_motox

Hi In my program one of my function returns a vector<int> ... I want to save it in to a vector<string>. itoa function does not seem to work here. Is there anything that can be done regarding this. Thanks in Advance.

Member Avatar for iamthwee
0
203
Member Avatar for yonex

#include <string> #include <map> #include <iostream> using namespace std; struct arrtibute { const char* name; int id; }; typedef std::map <std::string, arrtibute*> AtrributMap; AtrributMap atrributeMap_g; const int MaxCount = 3; void InitData() { for (int i = 0; i < MaxCount; i++) { static arrtibute atrr; std::string str; cout < …

Member Avatar for Laiq Ahmed
0
134
Member Avatar for WonderWomen204

hey there. This is Erinn Hansen and I have a quick question about this assignment I am working on. I pretty much have it, except for it's a little backwards. This assignment is: Write a program which accepts the following user input: priceOfHouse, numMonths Print an amortization chart as shown …

Member Avatar for WonderWomen204
0
168
Member Avatar for fluidDelusions

Hello! I'm having a very difficult time with this problem. What I'm trying to do is generate a sine wave for a specific frequency and output it as raw pcm data to a file. The sine wave is generated as follows: [code] samples[i]=static_cast<int>(32767 * amplitude * sin(static_cast<double>(i)*scale) ); [/code] where …

Member Avatar for ims
0
1K
Member Avatar for christiangirl

I'm getting this error: term does not evaluate to a function taking 1 arguments on the bolded and underlined parts of this code. I know this code isnt that great...has some extra stuff it doesnt need, but I'm working on that. This is pretty much the first program I've made …

Member Avatar for christiangirl
0
113
Member Avatar for Race

I new to programming and am having troubles writing C++ programs and would really appreciate help with the following question. Write a C++ program that reads from keyboard 3 words, with proper input prompt. Then for these 3 words that were read, the program displays first the word longest length, …

Member Avatar for Race
0
74

The End.