49,755 Topics
![]() | |
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 … | |
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, … | |
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 … | |
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++] = … | |
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 … | |
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 … | |
![]() | #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, … ![]() |
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( ) { … | |
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 … | |
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: … | |
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 … | |
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 | |
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 … | |
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? … | |
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> … | |
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 … | |
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 … | |
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]. … | |
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) … | |
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); … | |
#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 && … | |
*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.* | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
**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", … | |
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 … |
The End.