I have an assignment that is giving me this annoying error I am wondering if anyone might know what is wrong I am by no means an expert and will take all feedback.
2 2497 - #include <iostream>
-
#include <cstring>
-
#include <cctype>
-
#include <string.h>
-
using std::cin;
-
using std::cout;
-
using std::endl;
-
-
{
-
strcpy(destination,source);
-
}
-
-
{
-
strcpy(destination,source);
-
-
int i=0 ,j=0;
-
for (i=strlen(source)-1;i>=0;i--)
-
{
-
destination[j]=source[i];
-
j++;
-
}
-
return destination;
-
}
-
-
{strcpy(destination,source);
-
int i=0, j=0;
-
for(i=0;i<strlen(destination);i++)
-
{
-
int ascval = destination[i]
-
if(ascval >=97 and ascval<=122) destination[i]-32;
-
}
-
return destination;
-
}
-
-
-
{
-
strcpy(destination,source);
-
int i=0;
-
for(i=0;i<strlen(destination) ;i++)
-
{
-
if (destination[i]==target) destination[i] = replace;
-
-
}
-
return destination;
-
}
-
int main()
-
{
-
const int WORDSIZE = 15;
-
char words[][WORDSIZE] = {"cattywampus", "collywobbles", "Lickety Split", "Kerfuffle", "Lollygag", ""};
-
char word[WORDSIZE];
-
-
// Test the copy function
-
cout << "Copy \"cattywampus\", should see \"cattywampus\".\n";
-
copy(word, words[0], sizeof(word) - 1);
-
cout << word << endl << endl;
-
-
// Test the limit on the copy function
-
cout << "Copy \"Supercalifragilisticexpialidocious\", should see \"Super\".\n";
-
copy(word, "Supercalifragilisticexpialidocious", 5);
-
cout << word << endl << endl;
-
-
// Test the replaceCopy function
-
cout << "Replace 'l' in \"collywobbles\" with 'b', should see \"cobbywobbbes\".\n";
-
replaceCopy(word, words[1], 'l', 'b', sizeof(word) - 1);
-
cout << word << endl << endl;
-
-
// Test the limit on the replaceCopy function
-
cout << "Replace 's' in \"Supercalifragilistic\" with 'd', should see \"duper\".\n";
-
replaceCopy(word, "Supercalifragilistic", 'S', 'd', 5);
-
cout << word << endl << endl;
-
-
// Test the caseChangeCopy function
-
cout << "Case change \"Lickety Split\", should see \"lICKETY sPLIT\".\n";
-
caseChangeCopy(word, words[2], sizeof(word) - 1);
-
cout << word << endl << endl;
-
-
// Test the limit on the caseChangeCopy function
-
cout << "Case change \"Supercalifragilistic\", should see \"sUPER\".\n";
-
caseChangeCopy(word, "Supercalifragilistic", 5);
-
cout << word << endl << endl;
-
-
// Test the reverseCopy function
-
cout << "Reverse \"Kerfuffle\", should see \"elffufreK\".\n";
-
reverseCopy(word, words[3], sizeof(word) - 1);
-
cout << word << endl << endl;
-
-
// Test the limit on the reverseCopy function
-
cout << "Reverse \"triskaidekaphobia\", should see \"ohpakediaksirt\".\n";
-
reverseCopy(word, "triskaidekaphobia", sizeof(word) - 1);;
-
cout << word << endl << endl;
-
-
cout << "Reverse \"Lollygag\", change case, and replace 'G' with 'Z', should see \"ZAZYLLOl\".\n";
-
replaceCopy(caseChangeCopy(reverseCopy(word, words[4], sizeof(word) - 1), word, sizeof(word) - 1), word, 'G', 'Z', sizeof(word) - 1);
-
cout << word << endl << endl;
-
-
cout << "Enter your entire name: ";
-
read(words[5], sizeof(words[5]));
-
cout << words[5] << endl << endl;
-
-
cout << "Reverse your name and change case.\n";
-
cout << caseChangeCopy(reverseCopy(word, words[5], sizeof(word) - 1), word, sizeof(word) - 1) << endl;
-
-
return 0;
-
}
Above main() you have code that's no in a function. All code must be inside a function. You may define variables outside a function but all code instructions must be inside a function.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Thomas Barth |
last post by:
Hi,
I was wondering if someone had any insight to what I am doing wrong. I
ve got a class with two methods that call static methods of another
class. When compiling my sourcecodes I get the error...
|
by: Ram Prasad |
last post by:
I am trying to write a simple libspf2 plugin code for my postfix
( milter)
I am getting this unhelpful error message when I try to compile
gcc -g1 -Wall -I/usr/local/include/spf2 -I. -c mfunc.c...
|
by: amitmool |
last post by:
hi, i have used the queue library file and try to use the template as
template <class QueueItem>
queue <QueueItem>::~queue() // line 25
{
}
template <class QueueItem>
void...
|
by: sam23 |
last post by:
Hi all, im new to this programming language and i tried to use my Xcode to build and run this code but i got a error :(, and another error is
i need a help guys
#include <GLUT/glut.h>...
|
by: mahmoodn |
last post by:
I have a program which uses boost 1.33.1 and it works fine with gcc 4.1 however now that I want to compile with gcc 4.4 it get many errors. For example somewhere in the boost files, it says:...
|
by: atiqah |
last post by:
#include <iostream>
using namespace std;
class DB;
class DM{
public:
DM(){}
DM (float meter, float cm);
friend int func(DM,DB);
};
|
by: AffinityCreate |
last post by:
Hi,
Not quite sure if someone will be able to help me but..........
I am currently trying to build a menu layout for a 20x4 LCD. I originally had the LCD working with the keypad to have a...
|
by: AffinityCreate |
last post by:
Hi I am trying to add the DS1307 to my project via I2C using both a keypad and LCD. So far I have been able to get my project working with a passcode entry, led, keypad input and LCD display. I as...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |