Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,405 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,183 people online right now. Registration is fast and FREE... Join Now!




Strings and source codes

 
Reply to this topicStart new topic

Strings and source codes

trbl
3 Feb, 2008 - 02:37 PM
Post #1

New D.I.C Head
*

Joined: 26 Jan, 2008
Posts: 20

This is a 2 part question. First I am having trouble taking information from
void shift(char *p1, char *p2, char *p3, char *p4, char *p5)
to be ableto use in a strcpy(). I want to assign the letters ABCDE (one to each *p# value) to this so that I can use it to shift in a circular fashion. I have a program which does this but I need to use the void statement above.

I have tried to use a char () but the following error occurs:
Error 1 error C2664: 'strcpy' : cannot convert parameter 1 from 'void (__cdecl *)(char *,char *,char *,char *,char *)' to 'char *' c:\documents and settings\car\my documents\visual studio 2005\projects\chapter 8 exercise 6\chapter 8 exercise 6.cpp 27

Any directions on how to do this or where to seach for an answer on how to corect this would be great.

The other question I have is in Visual Studio 2005 is there a way that this program will fill in all the source codes for you? I had mistakenly hit something before and this happened but I do not know how or why?

Thank you again.
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Strings And Source Codes
4 Feb, 2008 - 06:43 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,347



Thanked: 51 times
Dream Kudos: 25
My Contributions
Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: code.gif

Thanks.
User is online!Profile CardPM
+Quote Post

trbl
RE: Strings And Source Codes
5 Feb, 2008 - 04:25 PM
Post #3

New D.I.C Head
*

Joined: 26 Jan, 2008
Posts: 20

I am sorry I was unaware. I thought that I was not suppose to print the whole code. Below I have added what I have already written. I kind of combined two different codes hoping it will work but as I stated the trouble comes with creating a strcpy.

#include <stdio.h>
#include <iostream>
#include <string.h>

void shift (char *p1, char *p2, char *p3, char *p4, char*p5);


int main (int argc, char argv[])
{

char temp;
char p1 = 'A', p2 = 'B', p3 = 'C', p4 = 'D', p5 = 'E';


strcpy(temp, shift);
int move = 0;
int tmp = 0;

printf("Letters before they are shifted: ");

printf("ABCDE");
scanf("%c, &letter");


printf("\n\nHow many places would you like the letters shifted?");
scanf("%c, move");
if (move != 0)
{
printf("Letters after they are shifted: ");
for(tmp = 0; tmp<5; tmp++)

printf("\n");
}
return 0;
}
void letters(char *buffer, int places)
{
places = places%5;
for(int i = 0; i<5; i++)
{
buffer [i] = buffer[i] - places;
if (buffer[i]<6)
{
buffer[i] = buffer[i]+5;
}
}
}


Can you also tell me if Visoal studio has the ability to add the source codes?

Thank you.
User is offlineProfile CardPM
+Quote Post

KYA
RE: Strings And Source Codes
5 Feb, 2008 - 04:32 PM
Post #4

#include <nerd.h>
Group Icon

Joined: 14 Sep, 2007
Posts: 5,847



Thanked: 159 times
Dream Kudos: 1375
My Contributions
MSVS has something called intellisense (sic?) where if you have defined a function or a common used function when you type the first paraentheses it will show a list of possible parameters.


Your code needs code brackets code /code but with []

--KYA






edit: code brackets screw up

This post has been edited by KYA: 5 Feb, 2008 - 04:32 PM
User is offlineProfile CardPM
+Quote Post

MorphiusFaydal
RE: Strings And Source Codes
5 Feb, 2008 - 04:38 PM
Post #5

D.I.C Lover
Group Icon

Joined: 12 May, 2005
Posts: 1,212



Thanked: 15 times
Expert In: Hardware, Networking

My Contributions
code.gif
User is offlineProfile CardPM
+Quote Post

trbl
RE: Strings And Source Codes
5 Feb, 2008 - 05:36 PM
Post #6

New D.I.C Head
*

Joined: 26 Jan, 2008
Posts: 20

I am sorry once again. I think I am not understanding you. I actually did ask if visual basic has a way of doing it for you because I am missing my codes. I once was playing around with it and they suddenly appeared but I do not know how that happened. If therre is no possible way for the program to put them in for me I will have to go back and do that because right now I have none.
User is offlineProfile CardPM
+Quote Post

MorphiusFaydal
RE: Strings And Source Codes
5 Feb, 2008 - 06:13 PM
Post #7

D.I.C Lover
Group Icon

Joined: 12 May, 2005
Posts: 1,212



Thanked: 15 times
Expert In: Hardware, Networking

My Contributions
Visual Studio will show you code behind the GUI app you're designing. That being said, no, there is no way to get a compiler/IDE to generate the logic code for you.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/7/09 10:29AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month