49,757 Topics

Member Avatar for
Member Avatar for trantran

I am trying to have a C++11 compiler that works. It seems (if the publicity is right... and typically it never usually is!) that gnu g++ 4.8 might be it. So I installed Ubuntu 12.04 read the instruction on multiple sites, did EXACTLY as it was said, got (obviously) errors, …

Member Avatar for trantran
0
434
Member Avatar for tanmay.majumdar2

#include<iostream> #include<conio.h> using namespace std; char square[10] = {'o','1','2','3','4','5','6','7','8','9'}; void box(); int checkwin(); int main() { char f, g, e[10]={'o','1','2','3','4','5','6','7','8','9'}; int a; int c, d; for(a=1;(a<=9);a++) { int b; system("CLS"); box(); if(a%2==1) { cout<<"player 1 enter your num\n"; cin>>b; } else { cout<<"player 2 enter you number\n"; cin>>c; } if(b==1&&square[1]=='1') …

Member Avatar for CGSMCMLXXV
0
166
Member Avatar for GeneClaude

In this code, I need to put a limitation in every part where the user is asked to input data. The user will be asked to input a grade ranging from 50-100, and if his input is not in the range, the program will display a warning, and if the …

Member Avatar for CGSMCMLXXV
0
243
Member Avatar for jim.hurley

I try to reference a struct from another class in my code and it gives me an error, saying I have a syntax problem. //Figure index struct FIGURE_TYPE { //Where to crop the image from SDL_Rect crop; int x; int y; }; That's the struct in Figure.h, void set_camera ( …

Member Avatar for jim.hurley
0
607
Member Avatar for deceptikon

Another quickie. This is a basic class for working with Windows path strings. It's based off of .NET's System.IO.Path class, but doesn't contain any API dependencies (and thus doesn't normalize the paths, it's all straight string handling). Methods that I've personally found to be useful are included. The class is …

Member Avatar for deceptikon
0
392
Member Avatar for sarah.mathieson.7

I am new to c++ and to using graphics libraries, so please forgive me if I have made a silly mistake. I am trying to compile a program that creates a window with one button from an example I found online. This is the error I get when I try …

Member Avatar for sarah.mathieson.7
0
714
Member Avatar for dreday92

Can someone tell me why I get this error "terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check Abort trap" when i run the following code? user and reservations are vectors of two classes else if (str == "lookup") { getline(cin, Name, '\n'); if (Name == user.at(i).getName()) { for …

Member Avatar for deceptikon
0
735
Member Avatar for Beteabmlemma

Pleace help me with this!!!how can we change a decimal number into binary,octal and hexadecimal using c++????

Member Avatar for programmer007
0
367
Member Avatar for Kareem Klas

Hello members, I have started studying C++ with the book "C++ primer"( by Stanley B. Lippman, Josée Lajoie& Barbara E. Moo). I use Visual Studio 2012 Ultimate and make my projects on Win32ConsoloApllication. There was an example and I wanted to make it over for myself. #include <iostream> int main() …

Member Avatar for Kareem Klas
0
175
Member Avatar for P3C1

#include <iostream> using namespace std; int main() { int rows = 3, columns = 3; int ****p; p = new int***(); *p = new int**(); **p = new int*[rows]; for(int i = 0; i < rows; i++) { ***(p+i) = new int [columns]; //Crashed at ***(p+1) why? } } I'm …

Member Avatar for P3C1
1
138
Member Avatar for letterG

Hi all! I've just started working on my Binary Search Tree and already there's a problem that I can't seem to understand. Ok here's the problem, when I compile its ok but when I run it there's an error, i've managed to found where the problem is but I don't …

Member Avatar for letterG
0
159
Member Avatar for lewashby

Does anyone know how I can add "0" to the left side of a string? If I get "1234" I'd like to make it "012345", if I get "1234" I'd like to make it "001234". Any suggestions?

Member Avatar for Moschops
0
152
Member Avatar for abbashadwan

#include<iostream.h> #include<conio.h> #define size 5 int stack[size],top=-1; void push(int s[size],int &t,int m); int pop (int s[size],int &t); void main() { clrscr(); cout<<"1-push \n 2-pop \n 3-exit \n"; int x,y; do { cout<<"enter number to choice:"; cin>>x; switch(x) { case 1: cout << "enter anumber to push in stack \n"; cin …

Member Avatar for Ancient Dragon
0
227
Member Avatar for nitin1

i am learning C++ from a good time now.. but I am still very confused sometimes in the use of array(char) and string.. can anyone please tell me that what exactly all differences between string and char array ? what can i do with array which i can't do with …

Member Avatar for Lucaci Andrew
0
206
Member Avatar for Petcheco

Hello everyone. I saw a post of one of our friends here about a problem he found of the SPOJ website. So I went there to check it. I found it to be very cool; I started to do the exercises but when I got in the 2nd, a prime …

Member Avatar for Petcheco
0
204
Member Avatar for pinkesh25gar

#include<iostream> #include<vector> #include<stdio.h> #include<string.h> #include<stdlib.h> #include<algorithm> #define READY 1 using namespace std; typedef struct task_node { int task_id; int period; int wcet; int arrival_time; int deadline; int state; int ceu; int slacktime; }task; void read_input(vector<task> &); void print_task_vec(vector<task> &); bool comparebyperiod(const task&,const task&); bool comparebydeadline(const task&,const task&); bool comparebyslacktime(const task&,const …

Member Avatar for Ancient Dragon
0
252
Member Avatar for shaguftakhan

Problem Statement: You are required to write a program for calculating area of Trapezoid. Formula for calculating area of trapezoid is Where a and b are two bases of trapezoid and h corresponds to height.

Member Avatar for NathanOliver
-1
118
Member Avatar for ramy.merc

Hi programmers, I am a c# programmer but I have a very big project in C++ (Which I am not familiar with) and I am facing a big problem. As part of the project, I need to convert the image (any image of any type bmp,jpeg,png...etc) to grayscale using openMP. …

Member Avatar for Moschops
0
2K
Member Avatar for daniel1977

Dear Friends: I m hung up in Mod3 Ch5 Exercise 1. On line 149 (visible on my wiki below), the Xcode compiler throws an error saying that I'm not passing a valid parameter. http://www.jeffgeiger.com/wiki/index.php/School/CS270Mod3Ch5ProgEx1 As I understand it, remove(elem) takes an element and deletes any matching elements in the list …

Member Avatar for NathanOliver
0
142
Member Avatar for lewashby

In the following test case program I'M trying to figure out how I can use the remainder of divison to make a decision but I can not seem to get this test case to respond in the way that I think and want it to respond based upon the remainder …

Member Avatar for deceptikon
0
106
Member Avatar for trantran

I want to create an arrays pointing to the members of an object, something like this: // der1, der2, der3 or derived object of base class myobject{ der1 * d1; der2 * d2 der3 * d3 void do_op(){ *d3=*d1 + *d2;} // this must remain as time-efficient as possible typedef …

Member Avatar for kresimir
0
108
Member Avatar for ztdep

Dear friends: I am trying to convert a double to string format using the std::to_string function, but it gives me the following error message. i do not understand why the functgion does not support the double format. i use the vs2010. > error C2668: 'std::to_string' : ambiguous call to overloaded …

Member Avatar for tinstaafl
0
960
Member Avatar for on93

Can anyone tell me about this program how the delete tail work ? ..................................................................... void linklist::deleteSearchList(int id) { node * cur; cur = head; if (cur == NULL) return; // no node in list if (cur->link == NULL){ delete cur; head = NULL; }else if (id == head ->st.id){ cur …

Member Avatar for Lucaci Andrew
0
105
Member Avatar for kartouss

Hello, I need to encrypt an image but my program is accepting 16 bytes of data for encryption from a file named plaintext.txt.. The program is encrypting data in blocks of 16 bytes that is the 1st 16 bytes are read then it is encrypted and saved in the ciphertext.txt …

Member Avatar for gnrsu
0
1K
Member Avatar for ziadkassam
Member Avatar for ziadkassam
0
711
Member Avatar for uzair.tabassumwahla

#include<iostream.h> #include<conio.h> #include<stdio.h> #include<math.h> main() { system("cls"); int h,w,m; cout<<"Press1,if you are male"<<endl; cout<<"press2,if you are female"<<endl; cin>>m; if(m==1) { cout<<"you are male"<<endl; } if(m==2) { cout<<"you are female"<<endl; } cout<<"Enter your height="; cin>>h; cout<<"Enter your weight="; cin>>w; if(m==1) { if(h<60) { cout<<"you are unfit"; } if(h>=60&&h<65) { if(w<45) cout<<"you …

Member Avatar for Moschops
0
174
Member Avatar for zvjezdan.veselinovic

Hi everyone. My name is Zvjezdan Veselinovic and I am a student at Rasmussen College over in New Port Richey, Florida studying Game and Simulation Programming. For my student portfolio, I want to create a "tron-like"/ "snake-like" game called Colors and Explosions. I have so far arrow key movement. That …

Member Avatar for deceptikon
0
474
Member Avatar for uzair.tabassumwahla

#include<iostream> using namespace std; int main() { for(int i=0;i<13;i++) { cout<<"*"; if(i==0 || i==12 ||i==9) { for(int j=0;j<10;j++) { if(i==9 && j==0) { cout<<" "; } else cout<<"*"; } } else if(i==10) { cout<<" "; cout<<"*"; for(int j=0;j<7;j++) { cout<<" "; } cout<<"*"; } else if((i==1 || i==2 || i==11)) …

Member Avatar for CGSMCMLXXV
0
198
Member Avatar for triumphost

How can I calculate CLOCKS_PER_SEC.. It is defined as 1000 in ctime. I don't want it defined. I want to calculate the actual value.. I tried the below code but it seems to be giving me my CPU speed.. on a 2.8 Ghz processor, it prints 2800. On a 2.0 …

Member Avatar for deceptikon
0
2K
Member Avatar for uzair.tabassumwahla

> *Inline Code Example Here*hi i want to print the diamond as shown bellow,which is generic i mean depend on the user input.the following output is for "5", Heading Here 1 232 34543 4567654 567898765 4567654 34543 232 1

Member Avatar for uzair.tabassumwahla
0
105

The End.