|
Member 11004573 wrote: how to Use Vector In Template With Return Type. You need to be clearer about what you mean by this. There are many samples of vectors, templates and return types to be found on MSDN[^], CodeProject articles and through Google. However, if you have a specific coding issue then please show your code and expalin what errors you have.
|
|
|
|
|
e.g.
template <typename T> T find_max(const vector <T> & v)
{
}
However, as pointed out by Richard, there are many, many possibilities, without further details cannot help more.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
I have to ask: why is it that Richard is leanings sideways in your response? Are you implying he's drunk?
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Yes, Stephan
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
I have a prn file which prints bar-code. How can change the barcode value through File IO streams in VC++ 6.0
Kindly help me.
|
|
|
|
|
Can you tell what effort you put do this till now?
|
|
|
|
|
|
In order to replace content you have to recognize it. That is you have to write a (possibly simple) parser for the PRN file you are dealing with.
If the specifications of such PRN format are available then check them out, otherwise you have to (if possible) reverse engineer it.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
1. google for barcode reader source code
2. google for barcode printing source code
3. feed the former with your .prn file and get the code it represents
4. feed that to the latter to generate a new .prn file.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Hello Everyone!
Please Tell Me How To CONTROL KEYBOARD ARROW key and Move Any Object Through Keys in C++,Please Tell Me If Any One Have Knowledge Abut this.
|
|
|
|
|
Add some code to handle keyboard input[^] and adjust your object's position depending on which key is pressed.
|
|
|
|
|
Member 11004573 wrote: Please Tell Me How To CONTROL KEYBOARD ARROW key... Are you wanting to "click" the arrow keys programmatically, or are you wanting to handle key clicks?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I saw this code snippet on a web page that was talking about CUDA[^] cores:
Does anyone know the meaning of the syntax on the third line where they call the kernel function with those greater-than and less-than signs?
dim3 blockDim(16, 16, 1);
dim3 gridDim((width + blockDim.x - 1)/ blockDim.x, (height + blockDim.y - 1) / blockDim.y, 1);
kernel<<< gridDim, blockDim, 0 >>>(d_data, height, width);
cudaUnbindTexture(tex);
}
__global__ void kernel(float* odata, int height, int width)
{
unsigned int x = blockIdx.x*blockDim.x + threadIdx.x;
unsigned int y = blockIdx.y*blockDim.y + threadIdx.y;
if (x < width && y < height) {
float c = tex2D(tex, x, y);
odata[y*width+x] = c;
}
}
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
It is an extension of the NVIDIA CUDA compiler (see "Introduction to CUDA C"[^]: Triple angle brackets mark a call from host code to device code
— Sometimes called a “kernel launch”
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
Thank you.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
You are welcome.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
I have n no of objects of a class. So what I want to do is - I want to save those data to a file when my application exit.
So how it is possible to write multiple objects of same class to a file and read that file to make objects of the same class.
Thanks in advance.
|
|
|
|
|
Google "C++ Serialization"
There are many ways to do this; but it seems using the Boost serialization library is widely recommended.
I'd rather be phishing!
|
|
|
|
|
Or VARIANT, if it's Win32.
|
|
|
|
|
I can create toolbars to support small and large icons with code like this :
{
if (!m_StandardToolBar.CreateEx(this, TBSTYLE_FLAT, style| WS_VISIBLE , CRect(1,1 , 1, 1), ITB_STANDARD_TOOLBAR) )
{
TRACE0("Failed to create toolbar\n");
return false; }
CMFCToolBarInfo info;
info.m_uiColdResID = ITB_STANDARD_TOOLBAR;
info.m_uiHotResID = ITB_STANDARD_TOOLBAR;
info.m_uiLargeColdResID = ITB_STANDARD_LARGE_TOOLBAR;
info.m_uiLargeHotResID = ITB_STANDARD_LARGE_TOOLBAR;
m_StandardToolBar.LoadToolBarEx( ITB_STANDARD_TOOLBAR, info , FALSE);
m_StandardToolBar.SetWindowText( CMbString::mbLoadString(IDS_TOOLBAR_STANDARD));
}
When changing the "DPI" (what was the "large font/small font) settings before) MFC (Win32) will automagically resize the toolbar bitmaps to fit the new settings.
There are now 3 settings :
100% (smaller, default), 125% (medium) and 150% (Larger)
If the default small toolbar button is 16x16, then the other sizes will be 20x20 and 24x24
If the default large toolbar button is 32x32, then the other sizez will be 40x40 and 48x48.
Now if I have to do this "by the book" I would need to generate toolbars with buttons 16x16, 20x20, 24x24, 32x32, 40x40 and 48x48.
so for each toolbar I create I will have something like :
// pseudo code
UINT smallToolbarID;
if ( DPI == smaller )
{
smallToolbarID = 16x16;
largeToolbarID = 32x32
}
else if ( DPI == medium )
{
smallToolbarID = 20x20;
largeToolbarID = 40x40
}
else if ( DPI == larger)
{
smallToolbarID = 24x24;
largeToolbarID = 48x48
}
if (!m_StandardToolBar.CreateEx(this, TBSTYLE_FLAT, style| WS_VISIBLE , CRect(1,1 , 1, 1), ITB_STANDARD_TOOLBAR) )
{
TRACE0("Failed to create toolbar\n");
return false; }
CMFCToolBarInfo info;
info.m_uiColdResID = smallToolbarID;
info.m_uiHotResID = smallToolbarID;
info.m_uiLargeColdResID = largeToolbarID;
info.m_uiLargeHotResID = largeToolbarID;
m_StandardToolBar.LoadToolBarEx( ITB_STANDARD_TOOLBAR, info , FALSE);
m_StandardToolBar.SetWindowText( CMbString::mbLoadString(IDS_TOOLBAR_STANDARD));
Meaning that for each toolbar, I will have 6 different bitmaps to maintain?
Am I thinking this straight or is there a catch somewhere ?
Thanks.
Max.
I'd rather be phishing!
|
|
|
|
|
Hi
Did you go with this in the end?
Andrew
|
|
|
|
|
Respected Sir Please Tell me logical error in this code because i faced many difficulties in This Code, please solve this .
When i Execute the Code after Enter 1 Option it cannot get the name if it get the name the password field cannot execute.and more error in it like ,.
i want to get only 8 string/Number in Password but loop did not work correctly please answer me ASAP.
// student_Record_Management_C++_1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<string>
#include<stdlib.h>
#include<iomanip>
#include<stdio.h>
#include<conio.h>
using namespace std;
class Menu_Account
{
private:
int option,loop;
char name[20],pass[8],pass_1[8],color[10];
public:
void int_menu()
{
cout<<"\t\t\t-----------------------------------"<<endl;
cout<<"\t\t\t="" student="" management="" record="" system."<<endl;
="" cout<<"\t\t\t-----------------------------------"<<endl<<endl;
="" cout<<endl<<endl;
="" cout<<"\t\t\t-------------------------------"<<endl;
="" enter="" login="" id="" &="" password"<<endl;
="" cout<<"\t\t\t-------------------------------"<<endl<<endl;
="" cout<<"\t\t\t1:cretae="" new="" account."<<endl;
="" cout<<"\t\t\t2:already="" have="" accoutn."<<endl;
="" cout<<"\t\t\t3:exit."<<endl<<endl<<endl;
="" xyz:
="" cout<<"\t\t\tenter="" option:";
="" cin="">>option;
cout<<endl;
switch(option)
="" {
="" case="" 1:
="" return="" account_create();
="" break;
="" 2:
="" void="" login_id();
="" 3:
="" exit(0);
="" default:
="" cout<<"enter="" right="" input"<<endl;
="" goto="" xyz;
="" }
="" }
="" account_create()
="" system("cls");
="" cout<<"\t\t\t-----------------------------------"<<endl;
="" cout<<"\t\t\t="" student="" management="" record="" system."<<endl;
="" cout<<"\t\t\t-----------------------------------"<<endl<<endl;
="" cout<<endl<<endl;
="" enter="" information="" for="" new="" account."<<endl;
="" cout<<"\n\t\t\tenter="" your="" name:";
="" cin.getline(name,20);
="" password:";
="" for(loop="0;loop<8;loop++)
" cin="">>pass[loop];
}
cout<<"\n\t\t\tRe-type Password:";
cin>>pass_1;
cout<<"\n\t\t\tWhat Is Your Favorite Color:";
cin.getline(color,10);
}
};
int _tmain(int argc, _TCHAR* argv[])
{
Menu_Account obj_1;
obj_1.int_menu();
char choice;
fstream in_file("Student.txt",ios::in|ios::app|ios::out);
do
{
obj_1.Account_Create();
in_file.write(reinterpret_cast<char *="">(&obj_1),sizeof(obj_1));
cout<<"\nDo You Want To Add More Data:";
cin>>choice;
}while(choice=='y'||choice =='Y'|| choice=='1');
in_file.close();
system("pause");
return 0;
}
|
|
|
|
|
Looking at your code there are a number of issues. For example you call Account_Create() in your int_menu() function, and then call it again immediately on return. You should take all the menus and input code out of your class and just use the class for holding and manipulating its data. Start with a basic class definition and one function for getting details from the user. Compile and test that part, use your debugger to check that it saves and manages its data correctly. Then add the next function, compile and test that, etc. etc.
|
|
|
|
|
Hi,
Can you summarize whats the purpose of this code?
Because the way you are following is not correct. But we are here to guide you, try to summarize what you did for?, what you are expecting? and what support you required... You will get help definitely
Thanks
|
|
|
|
|
Thank you For Reply Me,
i used this code for making new account of user and save this data in the file after getting all detail in the main.
Please tell me Issue and coding Style Error in this code because i am New In C++ And i learn it By Self Nobody are there for helping me .
|
|
|
|