Anonymous
Edy
Anonymous
State whether the following are VALID 0r INVALID statement in C++.
(8 marks)
i. x = 12;
ii. 12 = x;
iii. y +y = x;
iv. y = x + 12;
Anonymous
if u know it guys, pls help..
Tushar
Valid
Invalid
Valid
Valid
Mr
Anonymous
I hope you will enjoy it 😭
alessandro
what is the best library to make two devices comunicate? ( i mean if someone know the implementation of tcp for avr )
Jose
alessandro
Jose
There is no "communication library" in firmware. There is no OSI models, neither partial OSI models, nor routers, nor switches, nor cross cables (except for rs232). Only there is-at hardware level- the OSI level 0: the communication -bitbanging protocols- istelf.
TCP doesn't have any sense at uC communications. It has a bunch of protocols at various OSI leves and, for example, serial protocol (rs232) doesn't have any. I2C doesn't have, too. SPI? Of course not.
That's why there is no "best" library, because there is no library
klimi
Dm
y + (y=x)
Ok. It will correct only with brackets, right?
klimi
Dm
I thought that + has higher priority and this make it wrong
klimi
oh right. i am wrong
klimi
with () it should work thought
Dm
I agree
Tushar
y + (y=x)
Yes but this is a valid expression
DaviChan
Dima
please, use pastebin, its really uncomfortable to read this code in this tg chat
Dima
rules
B4H
<script src="https://pastebin.com/embed_js/kTSAjEiS?theme=dark"></script>
B4H
Can anyone help me with the idea of copy construcor in this code
B4H
computer(long c, CPU cp, MEMORY& m, bool u, IO& i) :cost(c), cpu(cp), io(i),
used(u), memory(m)
B4H
this is the line im intrested in
Sarmat
Can anyone help with build Assimp to Android please?
Gregory
Can I share a YouTube channel about programming lessons?
the best for everyone
// swap first and last digit of a given number
#include <stdio.h>
#include <math.h>
int main(){
int number ,lastDigit , digitsCount , firstDigit ;
printf("Enter a number to swap first and last digit of number|");
scanf("%d",&number);
digitsCount = (int)log10(number); // its a function // its used to ease and find count of the digits
firstDigit=number/ pow(10,digitsCount);
lastDigit=number%10;
// //Swapping the first digit and last digit.
int x = firstDigit * (pow(10, digitsCount));
int y = number % x;
number = y / 10;
}
the best for everyone
I have a en error in this code and i couldn't solve it
Ilya
labyrinth
does assigning {0} to a char[X] zeros the memory?
B4H
\Device\NUL
What's the difference between WriteFile and WriteConsole on win32 API ?
Francisco
Hi. How can we change the font color of a specific portion of text to be displayed in a c program?
\Device\NUL
\Device\NUL
Plz don't pm @gunners1014
Anonymous
hi bro, i have a program.
only one cpp file.
who can help me static release pack.
🇺🇸
Hello everyone
Can someone tell me what’s wrong here
Francisco
And if i want to asign the content of a string to another string how can i do??
ahmet
read integers N(>=3) ,then read N integers.Find the lowest 3 numbers .input(5 ,4 1 3 10 8 ) output 1 3 4 . this is a question with solution i didn't understand the code #include<iostream>
using namespace std;
int main() {
int n, tmp, mn[3];
cin >> n;
for (int i = 0; i < n; i++) {
int value;
cin >> value;
if (i < 3)
mn[i] = value;
else {
// Find maximum position
int mx_pos = 0;
for (int j = 1; j < 3; ++j) {
if (mn[mx_pos] < mn[j])
mx_pos = j;
}
if (value < mn[mx_pos])
mn[mx_pos] = value;
}
}
// let's order the first 3 values. We can do in several ways
// Find maximum position
int mx_pos = 0;
for (int j = 1; j < 3; ++j) {
if (mn[mx_pos] < mn[j])
mx_pos = j;
}
// swap max with last
tmp = mn[2];
mn[2] = mn[mx_pos];
mn[mx_pos] = tmp;
// Swap first 2 elements if needed
if (mn[0] > mn[1]) {
tmp = mn[0];
mn[0] = mn[1];
mn[1] = tmp;
}
for (int i = 0; i < 3; i++)
cout << mn[i] << " "; // not ordered
return 0;
}
\Device\NUL
🇺🇸
\Device\NUL
\Device\NUL
Why the heck you guys are pm-ing
\Device\NUL
This groups is exists, doesn't need to pm
\Device\NUL
\Device\NUL
Or input three integers, and then compare the rest of input if could be swapped
\Device\NUL
the best for everyone
#include <stdio.h>
#include <stdbool.h>
int count_unique(const int a[] , int length);
int count_unique(const int a[] , int length){
int counter=0;
for (int i = 0; i < length; i++) {
bool matchFund= false;
for (int j = 0; j < length; j++) {
if (a[i] == a[j] && i!=j)
matchFund = true;
if (!matchFund) counter++;
}
}
}
int main(){
int a[]= {1,2,3,4,5,6,3,4,1,8,9,7,8};
// int length;
// printf("Enter the length");
// scanf("%d",&length);
int total_length= count_unique(a , 13);
printf("the total Unique elements length is %d",total_length);
return 0;
}
Iwan
Francisco
strcpy
I guess i'll have to use the library string.h
Iwan
Anonymous
how to learn C language as a beginner?
Anonymous
best question and best answer exactly
kww
stackoverflow before your eyes
Anonymous
I think it's easier to learn C than to write a question on Stack Overflow😂
Anonymous
Fr
What do (char c=45 ) mean?
kww
UrCodeBuddy️ 💻
U have a variable c and ur assigning the value 45
Fr
Arvin
45 of ASCII
Fr
Right?
kww
Ascci of 45?
as we know char represents a single character such as letter 'a' or the digit character '5'
but you can also use the numerical code to assign values
char c = 45; // ASCII
kww
but its poor style
the best for everyone
#include <stdio.h>
#include <stdbool.h>
int count_unique(const int a[] , int length);
int count_unique(const int a[] , int length){
int counter=0;
for (int i = 0; i < length; i++) {
bool matchFund= false;
for (int j = 0; j < length; j++) {
if (a[i] == a[j] && i!=j)
matchFund = true;
if (!matchFund) counter++;
}
}
}
int main(){
int a[]= {1,2,3,4,5,6,3,4,1,8,9,7,8};
// int length;
// printf("Enter the length");
// scanf("%d",&length);
int total_length= count_unique(a , 13);
printf("the total Unique elements length is %d",total_length);
return 0;
}
any help ?
Francisco
void bubble_sort(float array[100], int size){
int i, j, t;
for(i=0; i<size; i++){
for(j=0; j<size; j++){
if(array[j]>array[j+1]){
t=array[j];
array[j]=array[j+1];
array[j+1]=t;
}
}
}
for(i=0;i<size;i++){
printf("%d. %.2f\n",i+1, array[i]);
}
}
Francisco
Please what's the problem in this piece of code?
Anonymous
Anonymous
u have folat array, but created variable t integer
Francisco
#include <stdio.h>
#include <stdbool.h>
int count_unique(const int a[] , int length);
int count_unique(const int a[] , int length){
int counter=0;
for (int i = 0; i < length; i++) {
bool matchFund= false;
for (int j = 0; j < length; j++) {
if (a[i] == a[j] && i!=j)
matchFund = true;
if (!matchFund) counter++;
}
}
}
int main(){
int a[]= {1,2,3,4,5,6,3,4,1,8,9,7,8};
// int length;
// printf("Enter the length");
// scanf("%d",&length);
int total_length= count_unique(a , 13);
printf("the total Unique elements length is %d",total_length);
return 0;
}
You did not return any value in your function + you wrote some of your instructions as comments
Persia
What is auto constant?