49,755 Topics

Member Avatar for
Member Avatar for morganbrooke09

I can't get the accumulator right, It just keeps giving what the pay for the next day would be. Example: Enter 5 for workDays, get 0.32 for total Please let me know what it is I need to change. //This program calculates the total pay earned over x days. #include …

Member Avatar for triumphost
0
156
Member Avatar for triumphost

I have the following code to take a bitmap of a portion of the screen specified by the Box Area. Area is just a struct that holds Width, Height, X1, Y1, X2, Y2 and represents a box. Basically a RECT with additional features. For some reason, if Box is (0, …

0
86
Member Avatar for XodoX

The input looks like this: Start 0 Run 40 Disk 0 Run 20 End Each word and number means something. The number is the time and the word a command. What's the best way to loop through it and evaluate it? So it's 2 different elements per line that should …

Member Avatar for XodoX
0
137
Member Avatar for Suzie999

I'm currently concantenating an array like so... int _tmain(int argc, _TCHAR* argv[]) { //create buffer to receive path WCHAR pathbuf[MAX_PATH]; //get path into buffer DWORD pathlen = GetCurrentDirectoryW(MAX_PATH,pathbuf); //append file name to buffer pathbuf[pathlen++] = '\'; pathbuf[pathlen++] = 'f'; pathbuf[pathlen++] = 'i'; pathbuf[pathlen++] = 'l'; pathbuf[pathlen++] = 'e'; pathbuf[pathlen++] = …

Member Avatar for Suzie999
0
208
Member Avatar for triumphost

I've just read a tutorial on Classes Under the hood/behind the scenes. It says that: Foo* A = new Foo(); // Is different from: Foo* B = new Foo; What in the world? I never put the brackets for my classes like that. Why does the first initialize variables and …

Member Avatar for mike_2000_17
0
256
Member Avatar for codercpp1

I'm not sure how to do this, but i'm making a small shell in C++ in command line, with a few external scripts and executables being called. What I want to do is either make a simple web browser or a way to show web pages in C++, or if …

Member Avatar for c++Fun
0
1K
Member Avatar for Jackk123

#include "stdafx.h" #include <iostream> #include <iomanip> using namespace std; int main() { char stupac1, stupac2; for (static_cast<char>(stupac1)= 'A'; stupac1 <= 'Z'; ++stupac1) { for (static_cast<char>(stupac2) = 'a'; stupac2 <= 'z'; ++stupac2) cout << stupac1 << setw(5) <<stupac2 << endl; } return 0; } So before i make mistakes explaining this, …

Member Avatar for Jackk123
1
124
Member Avatar for poloblue

Good Afternoon, I'm having difficulties with a program that deal getting the letters frequencies from an input text file. So far I have this code. Cpp file: #include <iostream> #include <fstream> #include <string> #include <cstring> #include <cmath> #include <cstdlib> #include <iomanip> #include "lab_19_head.h" using namespace std; int main( ) { …

Member Avatar for Ancient Dragon
0
94
Member Avatar for XodoX

I have a linked list where the input is read into. The 2 types of input have to go into a queue. 1 queue for each type. I suppose that the output line of the linked list can be used to read it into the queue ? I know it …

Member Avatar for XodoX
0
145
Member Avatar for Lucaci Andrew

Hi. So I get this weird error message out from a QT application that i'm creating: 0xc0000005: read access violation at: 0x0, flags=0x0 Basically what I'm trying to do is to set in a QT List Widget an item of type QList Widget Item in which I store two things: …

Member Avatar for Lucaci Andrew
0
3K
Member Avatar for Remy the cook

I have to write a program that finds a pattern in a text using Brute-force method. I have made functions to read the text file, pattern file and to execute the brute force algorithm(called match). These are called in main(). i need to store the index (at which the pattern …

Member Avatar for Remy the cook
0
231
Member Avatar for Psyho

Hello I am in need of information. I have the following: xx.func(1).func(2).func(3) how should the func be written for it to work? Thanks

Member Avatar for mike_2000_17
0
252
Member Avatar for Perry31

Can anyone elobrate me about Name Mangling? i tried to get name mangling for the below, struct sample { int a; char b; int a[1]; }; int myfun(int a, int b, int c[], struct a[]) { return 0; } int main() { struct sample Mystruct[2]; int a, b, c[9]; //Trying …

Member Avatar for Perry31
0
159
Member Avatar for binningen

I'm trying to use GNU flex to write a lexical analyzer. Is it possible to have multiple definitions for the same name in Flex? Like this: /* DEFINITIONS */ FRUITS "APPLE" | "ORANGE" | "LEMON" Also, what can we do and not do with string constants in flex's regular expressions? …

Member Avatar for L7Sqr
0
159
Member Avatar for poloblue

Good Afternoon, I'm having trouble with an assignments that deals with arrays. I'm stuck in the part that says Decide whether the value entered by the user at (2) is in the array numbers[SIZE] or not. So far I have this code #include <iostream> #include <fstream> #include <string> #include <cstring> …

Member Avatar for poloblue
0
137
Member Avatar for VernonDozier

I've been studying up on virtual destructors and how they work and I wrote this little program. I've been adding and removing the word "virtual" on lines 9, 16, and 23 to see what happens. #include <iostream> using namespace std; class a { public: a(){cout << "a::a()" << endl;} virtual …

Member Avatar for VernonDozier
0
207
Member Avatar for binningen

I'm having trouble opening a file using fopen in C++. I'm using XCode 4. Here's my code: FILE *f; f = fopen("test.txt", "r"); if (f == NULL) std::cout << "Error: NULL file"; When I run this, the error message gets printed. test.txt is stored in the same directory as my …

Member Avatar for binningen
0
1K
Member Avatar for osiron

I'm trying to create a program where I want to generate all permutations [1,2,3,4] and I recursively generate all the permutations of [1,2,3]: [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] and then put 4 back into the sequence of numbers. For example, with [1,2,3], we get [4,1,2,3], [1,4,2,3], [1,2,4,3], and [1,2,3,4]. …

Member Avatar for osiron
0
180
Member Avatar for triumphost

I just learned C++ style casting and the 4 types of casts. I'm not sure if I'm abusing it though. Examples: typedef long (*stringFromString)(int, char*) __cdecl; //TO: typedef long static_cast<*stringFromString>((int, char*)) __cdecl; SmartSetup((char*)World.c_str(), (char*)",f5", 765, 503,(char*)""); //TO: SmartSetup(static_cast<char*>(World.c_str()), static_cast<char*>(",f5"), 765, 503, static_cast<char*>("")); memcpy(&INH, (void*)((DWORD)Buffer + IDH.e_lfanew), sizeof(INH)); TO: memcpy(&INH, static_cast<void*>(static_cast<DWORD>(Buffer) …

Member Avatar for mike_2000_17
0
636
Member Avatar for triumphost

I have just came across a class for the first time ever that does not have variables in any of it's declarations but has them in the implementation. Why is this class behaviour allowed? What are the benefits of not putting variable names? class Testing { public: Testing(int, int, int); …

Member Avatar for deceptikon
0
127
Member Avatar for RonKevin

#include<iostream.h> #include<conio.h> int lg, a; void gi() { cout<< "Enter Lowest Grade:"; cin>>lg; cout<< "Enter Average:"; cin>>a; clrscr(); } void display() { cout<< "Lowest Grade:"<<lg<<"\n"; cout<< "Average Grade:"<<a<<"\n"; } void eval() { char ch; if(lg>=85 && a>=92) cout<<"Remarks: Full SCHOLAR"; if(lg>=85 && a>=90 && a<=91.99) cout<<"Remarks: Half SCHOLAR"; if(lg>=80 && …

Member Avatar for RonKevin
0
260
Member Avatar for silvesterphilip

*i like to study c programming from its basis to full., any website for c tutorial with simple and full contents? i search in google but no get a good site.*

Member Avatar for Lucaci Andrew
0
46
Member Avatar for txhornsfan

I am having problems with my code. I think it is the print function, but I'm not sure. Everything compiles correctly. Just no output. Any help is appreciated. Thanks Here is what I have: #include <iostream> using namespace std; struct node* tree = NULL; struct node { int data; struct …

Member Avatar for Lucaci Andrew
0
215
Member Avatar for phorce

Hello, I'm currently working on a project that basically reads some text and then performs basic Lexical Analysis on the text. I'm having a slight problem with overloading methods. So for example, I have a method that can read in the words from a txt file and another method which …

Member Avatar for phorce
0
181
Member Avatar for poloblue

Good Afternoon, I'm having problems with my school assignment that is about a loan program. Here are the details what the program needs to do. You are required to write a loan program for the Rio Grande Bank. This program will print an amortization table for a loan, given the …

Member Avatar for poloblue
0
7K
Member Avatar for Remy the cook

I am new at coding. I wanted to read from a file(text) and then write it to another file many times so that the file I write to becomes as large as 20MB..I read Harry Potter book for that....the code works just fine for 1000 lines etc..the file is read …

Member Avatar for Remy the cook
0
177
Member Avatar for Monster99d

I have an error called Unexpected Token 'class', did you forget a ;? I have no clue what is going on. Maybe you guys can help me out. The codes name is Player.h. The error is on line 9. #ifndef PLAYER_H #define PLAYER_H #include "Weapon.h" #include "Armor.h" #include "Monster.h" #include …

Member Avatar for Monster99d
0
4K
Member Avatar for jonnyboy12

Hello i am using a web browser control in my program with ms visual. I use the web browsers internal functions to do things like, cut, copy, select, CreateLink....It looks like this. this->webBrowserBody->Document->ExecCommand("CreateLink", false, nullptr); ............ Ok, that will bring up and insert link dialog. The dialogs are blank in …

0
82
Member Avatar for Dudearoo

**Dudearoo** *Useing Code::Blocks* Hey you guys! ive got a problem with a 'test' program i have made for saveing strings. heres the code: #include <iostream> #include <cstdlib> #include <stdio.h> #include <time.h> #include <conio.h> #include <stdlib.h> #include <iomanip> #include <windows.h> #include <fstream> using namespace std; int main() { ofstream myfile ("savefile.txt", …

Member Avatar for Dudearoo
0
138
Member Avatar for lewashby

I'M working my way through a C++ book and now I'M doing a card deck program. Here's the line I'M having trouble with. r = card % 13; // r = random 0 to 12 card in this case is just a random int number from 0 to 51. 52 …

Member Avatar for TrustyTony
0
155

The End.