20 Discussion / Question Topics

Remove Filter
Member Avatar for
Member Avatar for Auroch

Hello everybody! I'm trying to display the result of difference of two-dimensional vectors using friend overloading. Builder shows the following error after compilation (line 40). What should I change for in my code in order to find the problem? Thanks in advance. **[C++ Error] 05_Part.cpp(40): E2034 Cannot convert 'double' to …

Member Avatar for Auroch
0
241
Member Avatar for Auroch

Hello everybody! I'm trying to display the result of addition of vectors. But Builder shows the error after compilation (line 29). What should I change for in my code in order to find the problem? Thanks in advance. #include <iostream.h> #include <iomanip.h> #include <conio.h> class CVector2D { public: CVector2D(double x0 …

Member Avatar for Auroch
0
259
Member Avatar for Elixir42

Dear Kind DaniWebbers, I am trying to overload the fstream operators (ofstream/ifstream), so that I can save a class to a 'Binary' file and also display it with cout. But the ways in which each need to be implemented is different. Please can you show me how to define different …

Member Avatar for vijayan121
0
4K
Member Avatar for Denral

#include <iostream> int main () { cout <<"***\n"; return 0; } just an idea ... it is a short code but anyway it doesn't work (i just started c++ and i have dev c++ 4.9.9.2 c) cout isn't working

Member Avatar for blueshiftdani
0
182
Member Avatar for mohamed.rani

want to change all printf to cout with keeping the same output #include <iostream> using namespace std;Heading Here void main() { unsigned int a,b,c; char*format1 , *format2; format1 = "%04x%s%04x=%04x \n"; format2 = "%c%04x=%04x \n"; a = 0x0ff0; b = 0xf00; c=a>>4; printf (format1,a,">>",4,c); c=a&b; printf (format1,a,"&",b,c); c=a|b; printf (format1,a,"|",b,c); …

Member Avatar for Ancient Dragon
0
170
Member Avatar for softwaretime

Could someone please help me find out what the problem is with this simple program? This souldn't be happening. Here is the code: #include "stdafx.h" using namespace std; int main () { int numbers[5]; int * p; p = numbers; *p = 10; p++; *p = 20; p = &numbers[2]; …

Member Avatar for softwaretime
0
260
Member Avatar for Everlight

Hello, I have the following code: `#include <iostream.h> void main() { double test=3.46578953218549; cout.setf(ios::dec); cout<<test; }` I understand that iostream.h is outdated and Microsoft Visual Studio has iostream. However, When I remove the ".h" the setf, ios, etc, line 6 has multiple errors. So, my question is: How do I …

Member Avatar for Everlight
0
3K
Member Avatar for hello10
Member Avatar for deluksic

Well... im making some kind of graphic engine for console in [B]c++[/B], ASCII based, just for exercise... anyways, i was wandering, can i print text [B]faster[/B]? Right now i'm printing the whole map of characters (pix[160][120]) in a [B]single line[/B], so it is fast, however i need it faster cause …

Member Avatar for deluksic
-1
2K
Member Avatar for Sudo Bash

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 …

Member Avatar for Sudo Bash
0
2K
Member Avatar for Shodow

can u help me convert the cout to printf..i dont have a clue how.. tnx [CODE]#include<iostream.h> #include<string.h> #include<conio.h> int findSimilar(char[],char[]); void checkValue(int,int); int main(){ char boy[50]; char girl[50]; int similarInBoy=0; int similarInGirl=0; int total; clrscr(); cout<<"Enter Boy's Name: "; cin.getline(boy,50); cout<<"Enter Girl's Name: "; cin.getline(girl,50); similarInBoy=findSimilar(boy,girl); similarInGirl=findSimilar(girl,boy); total=similarInGirl+similarInBoy; cout<<"Boy: "<<similarInBoy<<","; …

Member Avatar for Narue
0
550
Member Avatar for tikoti

Hi all! I have a little problem here, I would like the width function in cout applied to all the sucesive outputs. However, it is only applied to the next output only, I mean, with this code I get 0:00:10:20:30:4 1:01:11:21:31:4 2:02:12:22:32:4 3:03:13:23:33:4 4:04:14:24:34:4 5:05:15:25:35:4 6:06:16:26:36:4 7:07:17:27:37:4 8:08:18:28:38:4 9:09:19:29:39:4 and …

Member Avatar for tikoti
0
2K
Member Avatar for niggz

Hello everyone. I am working on my final project at university for C++, and I got stuck a little. I have an array inside an array. And I want to access that inner array's member and print it with cout. Here is the code: [code=c] void standings(userClub uc){ cout << …

Member Avatar for niggz
0
406
Member Avatar for nightcracker

Hi! I've recently converted some C code to a bit more native C++. This included changing printf() statements to std::cout statements. However, some printf()'s are rather lengthy and annoyingly long (and human-error-prone) to write in std::cout. Example (and this one is a short one): C-style: [CODE]printf("ERROR %d: %s: %s\n", event, …

Member Avatar for mike_2000_17
0
727
Member Avatar for bensewards

Hey guys, This is my first official post on DaniWeb :) I am new at programming in C++ using visual studios, and right now I am fooling around with storing user input into Arrays. I am having a problem with my code, using an array size of 3 to store …

Member Avatar for jonsca
0
209
Member Avatar for pradeey

hello there I was wondering how would we print numbers like xxxxxxxx.xxxx using cout? I know we can use setprecision() to get the decimals right to the dot. But i am looking to print the numbers left to the dot.ex: 00000012.12345 is there a way that i am unaware about …

Member Avatar for vidit_X
0
89
Member Avatar for aviavyne

Recently I was assigned to create a program driven by a main menu, followed by a submenu, followed by functions. Below is an attempt of mine, which does display the main menu, and from there a user must enter a value to proceed to a second menu, however it doesn't …

Member Avatar for Fbody
0
301
Member Avatar for maddav

Hi, Recently (today) got an assignment to take a particular code that we've done previously, and split it into 3 files: 2 .cpp files and a header file. Now, i believe i've done it correctly, but the only thing that's throwing up errors is the use of friend for overloading …

Member Avatar for maddav
0
3K
Member Avatar for Drenon

hi im working on a project for uni. i am doin a games software development course and i am currently working on a small game. we have to then optimise it so it runs as fast as it can to prevent lag. though im getting alot of bottlenecks around cout …

Member Avatar for Drenon
0
204
Member Avatar for Alibeg

I guess i'm missing something basic, but i'm new to C++ and do not know how do these streams behave. Can someone please explain why no text is printed to the screen in the following example: [code=C++] #include <iostream> using namespace std; int main (void) { char *ptr = NULL; …

Member Avatar for Alibeg
0
154

The End.