49,757 Topics

Member Avatar for
Member Avatar for andreasen12N

No, this is not an assignement. Recently I decided to pick up writing code again and the project I started writing I came to a rode block with something that I never learned in class (I don't think). How would I be able to write this better (should I stick …

Member Avatar for np complete
0
118
Member Avatar for Suzie999

Hi, I'm hoping someone might be able to help me with what I think might be a simple problem. I have came across the need to add to an unsigned char array a literal single quote "'" My question is how can I achieve that? unsigned char uArray[4]; uArray[0] = …

Member Avatar for Bob
0
126
Member Avatar for TheRazzle

Ok im new to C++ so please help, so I have this line of code. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 3); cout << "Congratulations your power level is now" << PowerLevel << endl; insted of typing this all the time can i just add it to another cpp file and just reference it or …

Member Avatar for deceptikon
0
139
Member Avatar for samohtvii

Hi all, I am having trouble getting a tree to and from a text file. The text file will hold questions and animals. Each node should hold one question and one animal. So if you can imagine: Does it have 4 legs? / \ Does it purr? Does it swim? …

Member Avatar for samohtvii
0
3K
Member Avatar for fishsticks1907

hello, im having troblue getting my linked list to show everything on the list. it only shows the first node, and nothing afterwards. #include <iostream> #include <string> class list { private: struct node { std::string name; std::string phone; node *next; }*head, *tail; public: list() : head(0), tail(0) {} ~list(); void …

Member Avatar for fishsticks1907
0
149
Member Avatar for maurinnoe

i am having difficulties in creating an **array** that holds marks for three students each having a set of five marks, this program should allow the user to input the marks per student ,** then calculate the highest and lowest mark for each student**

Member Avatar for deceptikon
0
37
Member Avatar for vikuseth

In the below programme i use one boolean variable named check , which is being accessed inside main function by two objects of Tst1 and Test2 . But the value of check variable is not maintained in the programme . we can use static but i want to know some …

Member Avatar for ravenous
0
139
Member Avatar for inthiran115

#include<iostream> #include<cstdlib> #include<fstream> using namespace std; int main() { int n=3; float total,wait[3]={0}; float p[3],twaiting=0,waiting=0; int proc; int stack[3]; float burst[3],arrival[3],sburst,temp[3],top=3; for(int i=0;i<n;i++) { p[i]=i; stack[i]=i; cout<<"Enter arival time : "; cin>>arrival[i]; cout<<endl<<"Enter burst time: "; cin>>burst[i]; temp[i]=arrival[i]; sburst=burst[i]+sburst; for(i=0;i<sburst;i++) { proc=stack[0]; if(temp[proc]==i) { //temp[proc]=i+1;; twaiting=0; } else { twaiting=i-(temp[proc]); …

Member Avatar for Despairy
0
82
Member Avatar for sanghai45

Hi community, I wanted help in making shortest path Finder for non grid based game. Below is the image attached of which i wanted to do shortest path finding. There are nodes and each node may link to 5 or 6 nodes. I have no idea which algorithm will get …

Member Avatar for Despairy
0
164
Member Avatar for inthiran115

#include <iostream> #include <vector> #include <string> #include <fstream> #include <sstream> #include <windows.h> using namespace std; class Subject { protected: string sub_code; string sub_fac; public: Subject(string sub_code="", string sub_fac="") { this->sub_code = sub_code; this->sub_fac = sub_fac; } string getSubCode() {return sub_code;} string getSubFac() {return sub_fac;} }; class Student { protected: string …

Member Avatar for np complete
0
275
Member Avatar for sanghai45

I want to make level editor in which I want it to have three buttons CreateNode , Reset Node Create Node - It will add node in screen Reset Node - It will reset all the links from the Node And when the node is created on window if I …

Member Avatar for sanghai45
0
226
Member Avatar for breezeonhold

I'm getting the exact output I want but I keep getting an error that says "Run-Time Check Failure #2 - Stack around the variable 'c' was corrupted." Now I have to for this assignment use strncpy, and strncat and I'm trying to append two strings togethor with the max amount …

Member Avatar for m4ster_r0shi
0
141
Member Avatar for breezeonhold

I can't find the bug in my code. The error that pops up says "Expression: invalid null pointer". Visual studio isn't giving me any line to go to or really any help except once I run the program the error above pops up. The weird thing is everything compiles correctly …

Member Avatar for breezeonhold
0
275
Member Avatar for RonKevin

...Just run the program and you'll know whats wrong with it...it gives a -1 value... #include <iostream.h> #include <conio.h> void main() { int array[10],key; cout<<"Enter 10 elements:\n"; for (int c = 0; c < 10; c++) cin>>array[c]; clrscr(); cout<<"\n List of Elements:"; for ( c = 0 ; c < …

Member Avatar for RonKevin
0
339
Member Avatar for rfrapp

Hello, I am trying to fill an array with 20 unique random values between 1 and 60. I know what I need to do to get this to work, but I'm not sure how to do it. Here's what I've got: void fillArray( int arr[], int size) { int arr2[20]; …

Member Avatar for RainbowMatrix
0
2K
Member Avatar for abi_gurl

I'm creating 7x10 array that filled 0's unless it is copied by ships.Currently I'm having a problem in which I'm not sure how to place the ships inside this grid. this is how i've created the map. Please help as I'm a very beginner in c++. Thank you. void displayBoard() …

Member Avatar for abi_gurl
0
148
Member Avatar for menonlinux

I am having TurboC installed in my system. Whenever I try to run a program written in C++ using graphics.h, the screen goes blank and my LED monitor displays a change to VGA mode and suddenly displays "NO SIGNAL" and return to normal mode when I press "alt+ctrl+del" only. I …

Member Avatar for Ancient Dragon
0
152
Member Avatar for Grandiago

Hi Everyone! I'm a user of Turbo C++ and my professor gave me an activity to make a Fibonacci sequence. No I already have the Code for it and it is working. The only problem is. I don't know how the FOrmula Works. I will show you the Code below: …

Member Avatar for vinnitro
0
301
Member Avatar for PinoyDev

Good day! I knew this is easy to all of you guys. But I need the most precise way to parse this string "**45:50"** and store the result in **two dimensional array with int as datatype**. The delimeter is "**:**". Thank you!

Member Avatar for WaltP
0
318
Member Avatar for romanromeo89

I'm trying to write a simple sqlite query in c++ using visual studio 2010. My problem is that i can't use a c++ variable inside that query. I was not able to find the right syntax. `sqlite3_prepare_v2(handler, "SELECT * FROM grammateas WHERE username==X;", -1, &statement, 0);` where X i would …

Member Avatar for romanromeo89
0
743
Member Avatar for Jsplinter

I wrote the following code to test which is faster: performing a multiplication and division many times, or accessing the results in a vector via iterators(perform the calculations ahead of time), or hard coding the results of those calculations into the program. I actually expected storing the results in the …

Member Avatar for Jsplinter
0
267
Member Avatar for Despairy

I was thinking about somehow using a static member that all the matrix cells will be defined by their value + the static value. but than i thought how can i do it? what is the easiest way of doing so without the need to run over the 10^6 cells? …

Member Avatar for Despairy
0
295
Member Avatar for sampsont

I like to have the name of the current method for logging purposes. For example: string Commands::test(StringTokenizer& tokens) { static string src("Commands::test"); ... _log.debug("message", src); } I'm worried that creating 'src' might cause a performance hit. I made the string static thinking it would only be constructed once, the first …

Member Avatar for sampsont
0
139
Member Avatar for coolikedat99

I am trying to make a program that generates a random number and asks the user to input the random number generated by the computer. Anyone know how to do this? This is my program: #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { int one; time_t …

Member Avatar for RainbowMatrix
0
291
Member Avatar for streetalex310
Member Avatar for Lucaci Andrew

Ok, so, this code snippet is a reply to this thread: http://www.daniweb.com/software-development/cpp/threads/425821/prime-number-c From what I understood form the OPs request, is that, he wanted an algorihm which would check for prime numbers in a given range, applying these conditions: a number is to be considered valid if: a. the number …

Member Avatar for RainbowMatrix
0
596
Member Avatar for stengeljjj

Using cout to produce output - double space = 4.0 - 1.9999999; cout << space << endl; result: 2 Why am I not getting 2.0000001 instead? What should the type be or the numbers to make this 2.0000001? Thanks

Member Avatar for JasonHippy
0
103
Member Avatar for daino

Would anyone know of a reporting toolkit library for C++ which can be compiled as part of a project. It will need to be ablue to display tables, display charts and be printable through a printer. Preferabely free though I haven't been able to find any at all. The closest …

Member Avatar for daino
0
507
Member Avatar for kris222

A means AMA but i cant figure out whats wrong cuz its gotta accept both capital and small letters help please #include<iostream.h> void main() { char x[2]; cout<<"What does the letter A mean in ACLC?"; cout<<endl<<"S:"; cin.getline(x,2); { if(x[0]=='A'||x[0]=='a') x[0]='y'; else x[0]='n'; { } if(x[1]=='M'||x[1]=='m') x[1]='y'; else x[1]='n'; } { …

Member Avatar for zeroliken
0
84
Member Avatar for BradenMurphy

I got this info off a website. tells u how to make a clock in C++... can anyone tell me how to make it so the PC doesn't use 100% cpu? if u look in task manager ull see <ProjectName> is using 100% cpu [code=c] // crt_clock.c // This example …

Member Avatar for Ancient Dragon
0
202

The End.