TRENDING NEWS

POPULAR NEWS

Whats Wrong With This Program

What is wrong with this C++ program?

#include
using namespace std;

int main()
{
int num, bigNum, power, count;

cout << "Enter an integer: ";
cin >> num;
cout << "What power do you want it raised to? ";
cin >> power;
bigNum = num;
while (count++ < power);
bigNum *= num;
cout << "The result is " << bigNum << endl;
return 0;
}

What is wrong with this program?

Like others have mentioned, char *r is not initialized. But I think there are other points worth mentioning.+ You shouldn't use that function "gets". It's okay in small program like this, but in bigger programs it can cause buffer overflow, because the "gets" function doesn't recognize the size of the string(as you can see, you didn't even assign a size to char *s). You can test this by creating two arrays with sizes, then using the "gets" function to enter two oversized string, and printing them.+ You don't really need that "strcat(str,"\0")", the function "gets" (or "fgets") already puts NULL at the end of the string.+ Maybe this is just me, but this program doesn't reverse the original string, it just print the reversed (which is stored in a different place). You can try swapping the characters

Whats wrong with this program in c++?

C++ is case sensitive. Try this:

int main()
{
int score = 1000;
float rScore = score;
return 0;
}

What's wrong with this C program?

Added 2016–11–29:Dear Sadia Ahmed,Now that there is a “source code,” we might be getting somewhere! There are several things wrong, where to begin? Syntax is clearly not your strong point!Item: the for loop is syntactically incomplete.Item: “uid=id[i]” is an assignment. You probably want a comparison (==)Item: “else{answer=0;}” is questionable: Initialize answer (to zero), and remove the else clause (since you break the for loop when setting answer to 1).Item: No file is accessed in the code shown.Item: the given source has a whole lot of declared but unused arguments.Good luck … What’s the context? Programming class?

What is wrong with this program?

Rewriting your mistakes:#include #include int main(){   int n,i;   printf("Enter the size of array");   scanf("%d",&n);   int *temp;   temp=(int*)malloc(n*sizeof(int));   for(i=0;i

What is wrong with my C++ program?

Please read the error message. It has the very answer you want :-)Error Message: “..must take exactly one argument”If you are new to programming, start reading Error Message and give it thought, before searching for answers.Answer:The Operator% Overloaded Member or simply Operator%() function must take only one argument. Why ? Doesn’t Operator % is a Binary Operator ? (You might ask). Yes. But, One of the argument to Operator%() is implicit. You have defined it as Member Function, so it First Argument is Implicit.Also, there are cases where the Operator%() function will take 2 Arguments, in such case, the Operator%() function should not be defined as Member Function, instead it should be defined as Friend function.

What is wrong with this program in Java?

First, you should notice the error message which helps you find out what is wrong with your code. Try to solve it by yourself, debug is an important skill for a coder.this program does have some syntax error. Like the “continue” should be used in a loop structure.And about this statement: “if (num / counter == 1);” you have to delete the semi-colon.Afterwards, this program is ready to run without syntax bugs. As to the logical bugs, it is up to yourself to figure it out.

Whats wrong with the program, the program is in the comments?

#includevoid input();void read();void friend();void main(){char ans;int pass=96753882;printf("+++++Hey..!this is a random security program+++++++");printf("\n\t\tPress Y to gain access=\t");scanf("%c",&ans);if(ans=='Y'){printf("\nTO gain access Enter the password=");scanf("%d",&pass);if(pass==96753882){printf("\n\nWelcome to the secret service Agent\n\n");friend();}elseprintf("Wrong password");}else{printf("\n\nNevermind come back when ready");}}void friend(){char rep,inp,in;printf("\nThank you For logging in Agent\n");printf("Would you like to read or Input data, Press R to read And I to input\n");scanf("%c",&in);if(in=='R')read();elseinput();}void read(){printf("You are in read mode now");printf("\nwhat would you like to read about");}void input(){printf("You are in input mode now");printf("Please Enter your report");}

What is wrong with this java program?

I'm writing a java program to change all the small letters in an inputted string into caps, and vice versa


import java.io.*;
public class smalltobig
{
public static void main(String []args)throws IOException
{
BufferedReader keyin=new BufferedReader (new InputStreamReader (System.in));

String inp;
int cnt = 0;int ctr = 0;
int z = 0;
char c = ' ';
char d = ' ';
String small = "qwertyuiopasdfghjklzxcvbnm";
String output = " ";

System.out.println("enter");
inp = keyin.readLine();

z = inp.length();

for(cnt = 0;cnt < z;cnt++)
{
for(ctr = 0;ctr < 26;ctr++)
{
if(inp.charAt(cnt) == small.charAt(ctr))
{
c = Character.toUpperCase(inp.charAt(cnt));
output = output + c;
break;

}

else
{
d = Character.toLowerCase(inp.charAt(cnt));
output = output + d;
break;
}

}


}


output = output.trim();

System.out.println(" new String is " + output);

}

}

What is wrong with my Pascal Program?

is rter pascal this eyar at schooladn i am trying to make a simple program.this is a small quiz which will only ask the user 1 question.if the answer is 1 it wil display correct if not, wrong.
pls tel em what i did wrong and what i need to do fro ti to work.
here isthe program:

Program quiz;
uses crt;
var
answer:string;
begin
writeln('Welcome to the quiz');
clrscr;
writeln('question 1:');
writeln('what is my name?');
writeln('1:Robert');
writeln('2:Daniel');
writeln('3:James');
readln(answer);
if(answer=2)then
writeln('corerct!');
else
writeln('Wrong!');
readln;
end.

Another thing.i am plamnning to put more questions.
do i need to add more variables or do arrays?or there is no need and i can keep on working on the varibale 'answer' on other questions?

Thanks a bunch!

TRENDING NEWS