49,761 Topics
| |
What i basically want is more than one character to be found. If h and a are in the string then it will print it. But it will only work if there is a single char. [CODE] #include <iostream> #include <stdio.h> #include <string.h> int main () { char str[] = … | |
Hello, I've been having problem with this problem since yesterday and i just recently started C++, so please don't judge. I have very confused to what the question is asking and how the C++ program will look like. Effective January 1st of each year, Gabriela receives a 5% raise on … | |
I am writing a program that should allow the user to enter however many payroll amounts they want for 3 different stores. It should then display the total payroll for the three stores. The first time through the loop is fine but the second time through, even though it appears … | |
My first thought was [CODE] int size = 0; cout << "Enter size of the array" << endl; cin >> size; int a[size]; [/CODE] Now I know that an array has to have a constant value, but I need that the user enters an integer and use that integer as … | |
Hey, I need to make a function that returns an array. How would I do so? And how would I make a variable that gets all the values in that function? Thanks, you guys :) | |
I've this quicksort code, and it compiles. The thing is, I don't know how to give random values (integers) to the vector. The program should ask for the vector's size and then create the x random integers so it can apply the quiksort method. [CODE]#include "stdafx.h" #include <iostream> #include <vector> … | |
Hello, I have a class Pdisk [CODE] class Pdisk { public : Pdisk(string diskname, int numberofblocks, int blocksize); private : string diskname; int numberofblocks; int blocksize; }; [/CODE] Now I want to make a class filesys which can access an object of class Pdisk. I am not sure how to … | |
Hey guys, I need some help. I'm using Microsoft Visual C++ 2010. I've heard about being able to write html in c++ I found a few tutorials but I can't understand them they're not very noob friendly. :( Can some of you guys give me a few codes so I … | |
I keep getting these error messages: "error LNK2019: unresolved external symbol "void __cdecl MainPhase(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > *)" (?MainPhase@@YAXPAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) referenced in function _main" "error LNK2019: unresolved external symbol "void __cdecl DrawForKaiba(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > … | |
I'm new to this site and am desperate for help. I'm learning C++ for university, and have just received my second project. it goes like this: Write a program in which: A random integer between 0 and 500 is generated at the beginning. The user is asked to guess the … | |
hi can someone helped me in my triangle ><? my prof told me to make a program that ask the user to input the height of the triangle and the user must be able to input the height.. and the triangle must be a triangle not a right triangle.. this … | |
Hello Daniweb, I am a student in my CSC 194 using Visual C++ 2008. I am designing a program according to these standards. Most of my knowledge is strictly textbook information so bare with me. [QUOTE]Imagine you are developing a software package that requires users to enter their own passwords. … | |
Hey I have this tough assignment that just keeps on getting harder and harder. I have 3 more functions to complete. Function1: I have to print the positions of the three consecutive values that have the largest average. If more than 3 consecutive values have the same average, print the … | |
As you may guess I'm pretty new to c++. I'm asked to write a program which would read and out put data files. Now im halfway through (that's why I'll ask you not to mind lots of what is on current code) but I'm stuck on this certain error for … | |
What are the settings I require so I can debug line -by line? Or else ,I can identify lines of code where run time errors are occuring.. I want to view exact line number of error in this code/[CODE]#include<stdio.h> #include<conio.h> #include<string.h> struct node {struct node * left,*right; int freq; char … | |
Hello all, I'm getting an error in the following code, and I can't figure out why exactly. Error is as follows: no match for 'operator>>' in 'scoresIn >> scoresArray' this is at line 28 on the code below. I'm trying to bring in some data from a text file into … | |
Well when I run my program the bar at the top says C:\programing\C++\Test\Test.exe (<<just an example) How do I change this? And how do I make the console window look more XPish (I heard it was called luna). Answer the title one first please. I wnt this too be all … | |
So example.txt contains this; [B]The Man Walked Into The Forest[/B] What I would like is for it to show, what line the word "Walked" is on. [CODE] #include <iostream> #include <fstream> #include <string> using namespace std; int main () { string line; string word = "Walked"; ifstream myfile ("example.txt"); if … | |
How do I create a message box that lets me display a variable? I also need to know how to display variables with text. Here is the code in the switch(message) statement that I have at the moment that doesn't work. [CODE] case WM_CREATE: CreateWindow( TEXT("button"), TEXT("Click"), WS_VISIBLE | WS_CHILD … | |
Hi all, I am trying to create a class to serve as a customized cout class. Right now I have made some test code to see if I can do it. Right now I am trying to make it function just like cout, but later I will have it do … | |
[url]www.learncpp.com/cpp-tutorial/103-aggregation[/url] In the example given they state a department can have a teacher and if a department goes out of scope/deconstructs it doesnt destroy the teacher that was in that department. for example in real life departments at different school change names,get added,and get deleted all the time. Just because … | |
Why is this possible (in VS2009): [CODE] struct outer{ struct inner1{ void f(){ inner2 in2; in2.g(); /* no previous forward declaraction*/ } }; struct inner2{ void g(){} } }; [/CODE] ... but not this (???) [CODE] struct outer{ /* This line required to remove error: struct inner2; */ struct inner1{ … | |
i have to count three districts 1, 2, 3 whom said no and whom said yes, which i had saved it in notepad the three districts. i have to use the while loop. i was trying ifstream iFile; inFile.open("vote.dat") while(district1 == yes) { cout <<"the district 1 said yes: "; … | |
hey everyone, m doing an assignment on bouncing ball,my code below doesn't bounce the ball,it just makes it move when the enter button is used,what can I do to make the ball bounce? [CODE] #include<alloc.h> #include<graphics.h> #include<conio.h> #include<stdlib.h> #include<dos.h> void main() { int d=DETECT,m; initgraph(&d,&m,"H:\\tc\\bgi"); int l=getmaxx()/2,t=0; int x=1,y=1; int … | |
| The output I expected was: [ICODE]alpha beta[/ICODE] I used the following code: [CODE]#include<iostream.h> #include<conio.h> void main() { clrscr(); char choice[2][5]={"alpha","beta"}; cout<<choice[0]<<endl; cout<<choice[1]; getch(); }[/CODE] But this is what comes: [ICODE]alphabeta beta[/ICODE] Can anyone tell me what I did wrong? Thank you. P.S.:I know I am not using standard c++, but … |
Trying to do some basic "Game of life", but for some reason i'm getting some weird results, the code: [CODE]#include "stdafx.h" #include "stdlib.h" #include <iostream> using namespace std; #include "windows.h" const int V=30;//Vertical const int H=40;//Horizontal char A[V][H]; int ne=0; //Set all to dead void setDead() { for (int i=0;i<V;++i) … | |
I'm sorry as this coding language is not in C++, but it is very simlar to it. I basically trying to learn how it works if I have an example of this: [CODE]new NodeArray[] { {0,0,0,0}, {1,1,1,1}, {2,2,2,2}, {3,3,3,3} }[/CODE] I want an example of it working on how to … | |
hello! i have to compile World of Warcraft (online game) server.. its been a week i'm looking for "Microsoft Visual C++ EXPRESS edition - 32-bit" for windows7. but i couldn't find it. does it exist? if so, then kindly give me the exact link to download it. recently i installed … | |
I am trying to write a function that will compute GPA. [CODE]#include "Student.h" #include "ClassInformation.h" Student* setupStudent(){ string f,l,idNo; double gPoint=0; Student *studPtr1; studPtr1 = new Student (); cout<<"Enter first name "; cin>>f; studPtr1->setfirstName(f); cout<<"Enter last name "; cin>>l; studPtr1->setlastName(l); cout<<"Enter A number"; cin>>idNo; studPtr1->setaNumber(idNo); cout<<endl; studPtr1->setGPA(gPoint); return studPtr1; } … | |
Is it possible to put a gap in a class definition? IE: [CODE]class a; class b { private: a test; public: a getA(){return test;} }; class a { private: int i; public: a(int i):i(i){} a operator+(int o)const{return a(i+o);} }; class b continued?//what? how? { void outputA(){cout<<a;} };[/CODE] This is just … |
The End.