C++ :: Program That Accepts Array Of Characters
Nov 18, 2014
Here's the question: Create a program that accepts an array of characters. And displays the converted array of characters into Upper case if it is given in Lowercase and vice versa. Don't use string, but char.
Example: mychar ="I am A conQUeror."
Code: //My Codes:
#include <iostream>
#include <conio.h>
using namespace std;
int main()
[Code] ....
View 5 Replies
ADVERTISEMENT
Sep 25, 2014
I was trying to code a program that accepts your first name and then last name and then displays it through another function. I have checked that the assignments are between similar type of variables and pointers, but I don't seem to get it right.
When first input is taken and then second one, the first one's value changes to same as the second. E.G if first name is L and second name is S and after second input both variables, first and sec, become equal to S. Why?
Code:
#include <stdio.h>
#include <stdlib.h>
//FUNCTION PROTOTYPES
char *input(void);
void show(char *f,char *s);
[code]....
View 7 Replies
View Related
Dec 8, 2013
I built a program that accepts two input from the user, using a array inside a loop, it is pass to a function inside a class which will display the two number, the problem is when the user is inputting a number and it is 1 the program continuously as the user to input a number, and when 2 is entered the program ask another number and end, but for example you entered 2 and 3. . . it will then outpu 2 and 4 (so 3 + 1 ) and always the last number is plus one. here is the code.
main.cpp
#include <iostream>
#include "newclass.h"
using namespace std;
[Code].....
View 5 Replies
View Related
Feb 4, 2015
I have a N queens (actually 8 queens to be specific) program that accepts the numbers in order by row. I need to get it so it accepts the numbers in order by column. At first glance I thought it was just one space different, but it turned out not to be and how to get the one space difference in there. My current code (which I'm aware isn't doing the column accepting right) is:
Code:
#include <iostream>
using namespace std;
int main() {
int board[8];
cout << "Enter the columns containing queens, in order by column: ";
for(int i = 0; i < 8; ++i) {
cin >> board[i];
[Code]...
What the output should be:
Code:
Enter the rows containing queens, in order by column:
7
6
5
3
4
2
1
0
.......Q
......Q.
.....Q..
...Q....
....Q...
..Q.....
.Q......
Q.......
What it is:
Code:
Enter the columns containing queens, in order by column:
7
6
5
3
4
2
1
0
........Q
.......Q.
......Q..
....Q....
.....Q...
...Q.....
..Q......
.Q.......
View 5 Replies
View Related
Jan 30, 2015
i want to display the grade report of two students in the table but this code will repeat the grade report of one student in the tables and what is wrong with this code below ?
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
[Code]....
View 3 Replies
View Related
Aug 10, 2014
You pros are once newbies like us. Hoped you might take a little time sharing your expertise. Got freaked out when our teacher gave us this activity, where she haven't taught this to us yet. So this is the activity (LOOPING) :
Write a program that accepts a positive integer. The program should be the same from the given output. Use do while to allow the user to continue or not.
OUTPUT must be:
n = 5
0
1==0
2==1==0
3==2==1==0
4==3==2==1==0
5==4==3==2==1==0
if n = 6
0
1==0
2==1==0
3==2==1==0
4==3==2==1==0
5==4==3==2==1==0
6==5==4==3==2==1==0
View 5 Replies
View Related
Aug 15, 2013
I've been tasked with righting a program that accepts three images and combines them into a panoramic view I'm having trouble getting started?
View 2 Replies
View Related
Feb 12, 2014
Write a function that accepts an array of integers and its size as arguments. The function should create a new array that is one element larger than the argument array. The first element of the new array should be set to 0. Element 0 of the argument array should be copied to element 1 of the new array, element 1 of the argument array should be copied to element 2 of the new array, and so forth.
The function should return a pointer to the new array. Use ONLY pointer parameters instead of arrays in both functions; use pointers (not subscripts) to move through elements of both arrays. Before calling the function, display your original array. When the function call is completed, display the new array.
Here is what i got so far:
#include <iostream>
using namespace std;
int *shifted (int * , int);
const int SIZE = 10;
int main () {
int array_size [30];
[Code] ....
View 1 Replies
View Related
Feb 16, 2014
write a function accepts two arguments, an array of integers and a number indicating the number of elements in the array. the function should recursively calculate the sum of all the numbers in the array. Demonatrate the use of the functions in a program that asks the users to enter an array of numbers and prints it sum
i had done this but it wont work
#include <iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
[Code].....
View 6 Replies
View Related
Mar 20, 2014
so my question is i want to print characters,no string just an array of characters,i do this but it s not working,maybe i have to put the '' at the end?
Code:
int main() {
int i;
char ch[5];
for(i = 0; i < 5; i++) {
scanf("%c",&ch[i]);
[Code]...
View 6 Replies
View Related
Mar 26, 2014
I have an array of characters. I am trying to find "houston". The only way I can think of to do this is to use a for loop and check each individual character. Is there an easier way to do this?
char string[] = "Fishing tourism miami atlanta dallas houston";
View 9 Replies
View Related
May 3, 2014
Assume you want to use a loop to process an array of characters starting from the beginning of the array. You want the loop to stop when you read the null terminator character from the array. Fill in the loop test condition that will make this work correctly.
index = 0;
ch = array[index];
while ( _____________________________)
{
// process the character
index++;
ch = array[index];
}
View 1 Replies
View Related
Apr 7, 2013
I have an array titled: char TypeOfSong[arraySize] where the array size is 15. I am reading data from a file into this array and the characters can be either 'C', 'D', 'E', or 'R'. Each of these characters stands for a word (sting) and when I output the array, I need the strings to show up, not the characters. I have been reading online and in my book but I can only find information on turning one array with the same characters into a string. How would I go about changing this character array with different characters into a sting?
The characters stand for:
C = Country
D = Dance Party
E = Elevator
R = Rock
View 5 Replies
View Related
Apr 16, 2014
I am currently having an issue with validating user input for a state abbreviation. I have an array where a list of abbreviations is stored to use as a comparison for whatever the user inputs. I have been able to get the list loaded properly but whenever i go to compare, it always comes back as true even if it isn't. Here is some relevant code:
static char stateTable[STATE_TABLE_SIZE][STATE_SIZE];
int main() {
char buffer[40], *testCustName[40], testState[5], testCode;
buffer[0] = '